Import SVG and preserve editable text

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Import SVG and preserve editable text

Post by alexlsg »

Hey guys!
Is it possible to import an SVG logo (like the one bellow) from Illustrator into Imagemgick, and preserve a circular/360o text to be editable?

https://gyazo.com/471ef48ec3f0888329c01f948887363c

thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Import SVG and preserve editable text

Post by snibgo »

IM rasterizes the SVG, which means it converts the image to pixels. You can edit these pixels.

If you want to edit the text before it is converted to pixels, edit the SVG file.
snibgo's IM pages: im.snibgo.com
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

Thanks again Snibgo,

So the only option to have a editable text on IM, is to create it INSIDE ImageMagick (not importing from any file like PSD, SVG, etc)?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Import SVG and preserve editable text

Post by snibgo »

I don't understand the question. If the text comes from an SVG file, you can edit that. If it comes from a command-line, you can edit that.

Once IM has converted it to pixels, you can't edit the text any more. You can only edit the individual pixels.
snibgo's IM pages: im.snibgo.com
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

Sorry if I didn't make myself clear...

I am doing this workflow, and it DOESN'T work:

1- Create logo in Illustrator, with editable text
https://gyazo.com/9c8f4ea8cd9496bed139b04f1decc4cd

2- Export logo as SVG (not sure if I need any special setting here)
https://gyazo.com/ee212392d1ceb6bc43f914a9f78ec200

3- Open on my ImageMagick tool, and be able to edit its text. However, when I import the SVG, it is "invisible"
https://gyazo.com/a66410501e90aeb1b38f85809a3a70e0



On the other hand, when I export the same SVG with text outline, it DOES work:

1- Convert text to outlines
https://gyazo.com/9f97c92e3bc09655c5dbf03e84e81a90

2- Export to SVG with same setting

3- Open on my ImageMagick tool, and it shows correctly
https://gyazo.com/9888e50569ea1e41dbe405ecfca67ac9


Maybe I am missing correct setting on the SVG export?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Import SVG and preserve editable text

Post by snibgo »

I'm not sure what you are asking. If you want advice on Adobe Illustrator, I can't provide any.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Import SVG and preserve editable text

Post by fmw42 »

What does "invisible" mean in your context? Is there nothing in the SVG file if you open in a text editor? Or do you mean that viewing the SVG as an image shows nothing but background. If the latter, then perhaps your text fill is transparent and you need to set it to some color other than transparent or the background color. You would do that in Illustrator or in a text editor to chance the color of the text.

What is your IM version and platform? Are you using the internal IM MSVG, RSVG or Inkscape delegate library in Imagemagick. See

Code: Select all

convert -list format


and see that delegate is being used for SVG
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

Thanks Fred,

I tested and the SVG (saved with editable text) is opening correctly when I open on Safari for example, and the editable text is preserved:
https://gyazo.com/4848b4d728c3942dffed686fdc56f54d

Here you can test my tool:
http://tshirtproject.wpengine.com/design/


You will see that:

1- When you select the Logo OUTLINED version (first one) it works fine
https://gyazo.com/315cce52b58800e8767aa1ac8e5ef804

2- When you select the logo EDITABLE TEXT (third option) it is invisible
https://gyazo.com/83696376f519332fcda62b4c43bd5276
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

About IM version, I'm checking with the developer! : )
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Import SVG and preserve editable text

Post by fmw42 »

You have not provided the SVG so that we can download and test.
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

Sorry Fred, there you go!

SVG with editable text (the one that is not working):
http://www.2shared.com/file/Fy2xctLV/fr ... etest.html

SVG with outlined/curved text:
http://www.2shared.com/file/6Ez-Z7-7/fr ... tline.html
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Import SVG and preserve editable text

Post by fmw42 »

Your link downloads as dmg. When clicked it has an installer that my antivirus software warns about. So I did not try to use the app. Please upload in a form that is not an app, perhaps as a zip file. I do not believe that DMG files are Windows-friendly, either.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Import SVG and preserve editable text

Post by snibgo »

Microsoft anti-virus reports both those SVG files as dangerous.

Looking at them in a text editor, "freedom machinetestoutline.svg" contains no text elements, just a whole load of curved paths.

"freedom machinetest.svg" does contain text, but as individual characters "SINCE 1887 Freedrom machine", each with a position and rotation and so on. Earlier in the file, the glyphs are defined for the font.

The SVG files are not designed to be easily editable. You could replace individual characters, but if the words changed length you would need to re-calculate xy positions, rotations etc.
snibgo's IM pages: im.snibgo.com
alexlsg
Posts: 45
Joined: 2016-08-03T08:04:20-07:00
Authentication code: 1151

Re: Import SVG and preserve editable text

Post by alexlsg »

snibgo wrote:Microsoft anti-virus reports both those SVG files as dangerous.

Looking at them in a text editor, "freedom machinetestoutline.svg" contains no text elements, just a whole load of curved paths.

"freedom machinetest.svg" does contain text, but as individual characters "SINCE 1887 Freedrom machine", each with a position and rotation and so on. Earlier in the file, the glyphs are defined for the font.

The SVG files are not designed to be easily editable. You could replace individual characters, but if the words changed length you would need to re-calculate xy positions, rotations etc.

Strange, will check what is wrong with the antivirus warning.

Do you know how can I save the svg, so it saves the whole text (not each carachter indivually)?

About it being "invisible" when imported, it probably also have to do with the text (as the outlined one works fine).
Have you ever used an SVG (created outside IM) inside IM with editable text? Just to make sure if it's possible or not...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Import SVG and preserve editable text

Post by fmw42 »

Export the SVG file from Illustrator and you have an editable text file, if Illustrator does not rasterize the result. You should be able to open that SVG file in Imagemagick. But if you save it to a new file, IM will rasterize it. Thus you won't be able to edit the SVG file's original text because all data in the SVG file will become pixels (small circles) and you will lose the text. But the original SVG file from Illustrator should be editable in any text editor.

You have yet to provide any original SVG file from Illustrator in a form that we can open. You should get the SVG file from Illustratior, then ZIP compress it and upload to some free hosting service and put the URL here. Do not compress it to some app such as DMG or EXE or anything that is platform dependent.
Post Reply