Re: script for embedding raster images
Can anyone try this and tell me if they understand what's going on?
Have you compared your output syntax with share/examples/data_uri.svg?
Aha! Adobe Illustrator does this: data:;base64 But, as shown in the sample file, Inkscape wants data:image/png;base64 or data:image/jpg;base64. I've fixed the script to write it the way Inkscape wants it: http://www.lightandmatter.com/embed_raster_in_svg The latest CVS version of Inkscape is now happy with the script's output.
I don't know if AI's output is standards-compliant in this situation or not. Presumably when AI reads one of its own SVG files, it just looks at the magic number from the data in order to figure out what type it is. (There are only two possibilities.) If omitting the type is legal according to the SVG standard, then maybe Inkscape should allow it on input.
P.S. If you plan to keep contributing to Inkscape I can give you developer access
That would be nice, thanks! Given my weak C++ skills and lack of familiarity with Inkscape's codebase, I probably wouldn't dare to committ changes to the C++ code on my own, except maybe after getting comments on them. But if the plan is to have an Extensions menu that can call various Perl scripts, then it might be nice for me to be able to contribute directly to that. My Perl skills are a lot better than my C++ skills, and I'm going to need to write various scripts anyway for my own use (e.g., I'm going to need something to gamma-correct svg files). Is there an API for extensions?
I've fixed the script to write it the way Inkscape wants it: http://www.lightandmatter.com/embed_raster_in_svg
Excellent, thanks! I tested it and it works when I run it on a file in the current dir, but when I tried to give it a file in a subdir tt/, I got this error:
$ ./embed_raster_in_svg.pl tt/a.svg embedded raster file New_document_1-path1061-4294967076.png, image/png error renaming file tt/a.svg to tt/a.svg.bak, No such file or directory at ./embed_raster_in_svg.pl line 114.
I don't know if AI's output is standards-compliant in this situation or not.
Consult http://www.faqs.org/rfcs/rfc2397.html to find out who is compliant and who's not
P.S. If you plan to keep contributing to Inkscape I can give you developer access
That would be nice, thanks! Given my weak C++ skills and lack of familiarity with Inkscape's codebase, I probably wouldn't dare to committ changes to the C++ code on my own, except maybe after getting comments on them. But if the plan is to have an Extensions menu that can call various Perl scripts, then it might be nice for me to be able to contribute directly to that. My Perl skills are a lot better than my C++ skills, and I'm going to need to write various scripts anyway for my own use (e.g., I'm going to need something to gamma-correct svg files).
Good, I added bcrowell to the project
Is there an API for extensions?
I know we're moving towards it, Ted Gould will probably be able to give you more specific info. If you can help him to work on the extensions system for the next version, this would be fantastic.
Also we have the ill2svg perl script that is used for importing illustrator files. I believe there were some issues with it that needed fixing (look up the bug tracker and list archives). In any case, since you're working with AI files and know Perl, you seem to be the ideal person to systematically test this script and write at least some documentation for it (what AI versions and what features are supported and what not, how to best prepare your files for import, etc). It might also make sense to incorporate the embed/outbed images functionality into it as an option.
Up spake Ben Crowell:
I don't know if AI's output is standards-compliant in this situation or not. If omitting the type is legal according to the SVG standard, then maybe Inkscape should allow it on input.
Inkscape should probably allow it regardless, since being compatible with AI is nearly as important as being compatible with the spec. We don't have the clout to force AI to fix its mistakes, yet :-)
On Mon, 13 Dec 2004 20:31:29 +1100, Trent Buck <fubarbaz@...104...> wrote:
Up spake Ben Crowell:
I don't know if AI's output is standards-compliant in this situation or not. If omitting the type is legal according to the SVG standard, then maybe Inkscape should allow it on input.
Inkscape should probably allow it regardless, since being compatible with AI is nearly as important as being compatible with the spec. We don't have the clout to force AI to fix its mistakes, yet :-)
I have to agree with that, though upon reading the RFC it's clear that the missing mimetype is interpreted as text/plain by default. So I think Inkscape is correct in its ignoring such images because technically, they're not images but texts. I'm not sure how to "fix" this because we probably use some library call to retrieve images from URIs.
From MAILER-DAEMON Mon Dec 13 06:13:58 2004
Date: Mon, 13 Dec 2004 15:13:51 +0100 (CET) From: MAILER-DAEMON@...375... (Mail Delivery System) To: inkscape-user@lists.sourceforge.net MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary="9C42D130287.1102947231/maat.univ-orleans.fr" Message-Id: <20041213141351.A3B96130151@...376...> X-Spam-Score: -4.9 (----) X-Spam-Report: Spam Filtering performed by sourceforge.net. See http://spamassassin.org/tag/ for more details. Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001 -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Subject: [Inkscape-user] Undelivered Mail Returned to Sender Sender: inkscape-user-admin@lists.sourceforge.net Errors-To: inkscape-user-admin@lists.sourceforge.net X-BeenThere: inkscape-user@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk Reply-To: inkscape-user@lists.sourceforge.net List-Unsubscribe: https://lists.sourceforge.net/lists/listinfo/inkscape-user, mailto:inkscape-user-request@lists.sourceforge.net?subject=unsubscribe List-Id: Inkscape User Community <inkscape-user.lists.sourceforge.net> List-Post: mailto:inkscape-user@lists.sourceforge.net List-Help: mailto:inkscape-user-request@lists.sourceforge.net?subject=help List-Subscribe: https://lists.sourceforge.net/lists/listinfo/inkscape-user, mailto:inkscape-user-request@lists.sourceforge.net?subject=subscribe List-Archive: http://sourceforge.net/mailarchive/forum.php?forum=inkscape-user
This is a MIME-encapsulated message.
--9C42D130287.1102947231/maat.univ-orleans.fr Content-Type: text/plain Content-Description: Notification
This is the Postfix program at host maat.univ-orleans.fr.
I'm sorry to have to inform you that the message returned below could not be delivered to one or more destinations.
For further assistance, please send mail to <postmaster>
If you do so, please include this problem report. You can delete your own text from the message returned below.
The Postfix program
<relations.exterieurs@...375...>: data format error. Command output: relations.exterieurs: Mailbox does not exist
--9C42D130287.1102947231/maat.univ-orleans.fr Content-Description: Delivery error report Content-Type: message/delivery-status
Reporting-MTA: dns; maat.univ-orleans.fr Arrival-Date: Mon, 13 Dec 2004 15:13:51 +0100 (CET)
Final-Recipient: rfc822; relations.exterieurs@...375... Action: failed Status: 5.0.0 Diagnostic-Code: X-Postfix; data format error. Command output: relations.exterieurs: Mailbox does not exist
--9C42D130287.1102947231/maat.univ-orleans.fr Content-Description: Undelivered Message Content-Type: message/rfc822
Received: by maat.univ-orleans.fr (Postfix, from userid 99) id 9C42D130287; Mon, 13 Dec 2004 15:13:51 +0100 (CET) Received: from min.univ-orleans.fr (unknown [192.168.87.6]) by maat.univ-orleans.fr (Postfix) with ESMTP id 7F3D3130151 for <relations.exterieurs@...375...>; Mon, 13 Dec 2004 15:13:51 +0100 (CET) Received: from univ-orleans.fr (localhost [127.0.0.1]) by min.univ-orleans.fr (Postfix) with SMTP id 323B712B038 for <relations.exterieurs@...375...>; Mon, 13 Dec 2004 15:13:50 +0100 (CET) From: inkscape-user@lists.sourceforge.net To: relations.exterieurs@...375... Subject: hi Date: Mon, 13 Dec 2004 14:19:48 +0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="51807403" Message-Id: <20041213141350.323B712B038@...377...> X-Spam-Status: No, hits=0.5 required=5.0 tests=NO_REAL_NAME version=2.31 X-Spam-Level:
--51807403 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
that is bad
--51807403 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
------------------! Message d'avertissement de virus / Virus Warning Message (on min)
location.zip is removed from here because it contains a virus.
--------------------------------------------------------- --51807403 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
------------------! Message d'avertissement de virus / Virus Warning Message (on min)
Found virus WORM_NETSKY.B in file location.exe (in location.zip) The uncleanable file is deleted.
---------------------------------------------------------
--51807403--
--9C42D130287.1102947231/maat.univ-orleans.fr--
Quoting Ben Crowell <crowell04@...327...>:
and I'm going to need to write various scripts anyway for my own use (e.g., I'm going to need something to gamma-correct svg files). Is there an API for extensions?
Hmmm...
Sounds perhaps like you might need to do more than just base gamma-correction. There are many issues on color in general that need to be addressed. What exactly are your needs for gamma-correction, and have you skimmed any of the wiki pages on color?
participants (4)
-
unknown@example.com
-
Ben Crowell
-
bulia byak
-
Trent Buck