IM skews font in vector eps files
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
IM skews font in vector eps files
I'm using ImageMagic command line to convert images from eps into png. When a figure (eps vector created with some version of Illustrator) is passed through ImageMagick (either command line or opened in the IM viewer) it comes out with skewed font. Note - it's not italic, just skewed - actual italic font displays as "super-italic".
I also have equations created using MathType which do not have this problem.
Both types of images generally have Times New Roman as the font and no errors about missing fonts are displayed be IM. My first guess was a font issue - but TNR is the most generic font one can use.
I've done some searches and keep coming up with results explaining how to skew the entire image (as far as I can tell this is not happening) or different commands for getting text to appear (I don't want ANYTHING to change in the images).
The command I'm using to convert the images is: convert -density 150 imageName.eps -fill none imageName.png (although as I said, it displayed the skewed font in the viewer as well).
OS: Windows 7 Pro (64 bit)
ImageMagick 6.8.8 Q16 (64bit)
GhostScript 9.14 (for working with eps files)
***********************************************************
SOLVED: Font issue with GhostScript. Solution appears to be to add the system variable GS_FONTPATH=C:\Windows\Fonts and restart. Maybe also a couple other things...but I'm pretty sure that's what solved it.
I also have equations created using MathType which do not have this problem.
Both types of images generally have Times New Roman as the font and no errors about missing fonts are displayed be IM. My first guess was a font issue - but TNR is the most generic font one can use.
I've done some searches and keep coming up with results explaining how to skew the entire image (as far as I can tell this is not happening) or different commands for getting text to appear (I don't want ANYTHING to change in the images).
The command I'm using to convert the images is: convert -density 150 imageName.eps -fill none imageName.png (although as I said, it displayed the skewed font in the viewer as well).
OS: Windows 7 Pro (64 bit)
ImageMagick 6.8.8 Q16 (64bit)
GhostScript 9.14 (for working with eps files)
***********************************************************
SOLVED: Font issue with GhostScript. Solution appears to be to add the system variable GS_FONTPATH=C:\Windows\Fonts and restart. Maybe also a couple other things...but I'm pretty sure that's what solved it.
Last edited by LadyCygnus on 2014-04-24T13:54:35-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM skews font in vector eps files
I don't have other software that can view EPS files, so I can't help.
If you post a sample EPS file somewhere like dropbox.com and paste the URL here, someone might view the image with other software (eg Adobe something) and comment on any difference to ImageMagick.
If you post a sample EPS file somewhere like dropbox.com and paste the URL here, someone might view the image with other software (eg Adobe something) and comment on any difference to ImageMagick.
snibgo's IM pages: im.snibgo.com
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
Here are the files: https://app.box.com/s/9e1wnasg7uld3bw345bv
I've included
- original eps files (figure & equation)
- png files using the convert command with IM
- png screenshots of the eps files opened in IM viewer.
When I open the files using Adobe Illustrator they show up fine (roman text). When I open up the figure with IM it opens up with the text skewed - the equation works just fine.
I've included
- original eps files (figure & equation)
- png files using the convert command with IM
- png screenshots of the eps files opened in IM viewer.
When I open the files using Adobe Illustrator they show up fine (roman text). When I open up the figure with IM it opens up with the text skewed - the equation works just fine.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
Your eps image is CMYK and PNG does not support CMYK.
I tried
convert -density 300 figure.eps figure.png
convert -density 300 -colorspace sRGB figure.eps figure.png
convert -density 300 -colorspace sRGB -strip figure.eps figure.png
convert -density 300 figure.eps figure.tif
They all produced slanted text.
But if I open your eps in Photoshop and change the colorspace to RGB and save as eps and then do
convert -density 300 figure2.eps figure2.png
It does not have slanted text, but the background is white (in both the eps and png image)
I am running IM 6.8.8.10 Q16 Mac OSX
I tried
convert -density 300 figure.eps figure.png
convert -density 300 -colorspace sRGB figure.eps figure.png
convert -density 300 -colorspace sRGB -strip figure.eps figure.png
convert -density 300 figure.eps figure.tif
They all produced slanted text.
But if I open your eps in Photoshop and change the colorspace to RGB and save as eps and then do
convert -density 300 figure2.eps figure2.png
It does not have slanted text, but the background is white (in both the eps and png image)
I am running IM 6.8.8.10 Q16 Mac OSX
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
...yes......and no.fmw42 wrote:Your eps image is CMYK and PNG does not support CMYK.
But if I open your eps in Photoshop and change the colorspace to RGB and save as eps and then do
When I open the eps file in Photoshop (which rasterizes it), set the colorspace to RGB and save as a Photoshop EPS it works in IM
When I open the eps file in Illustator and set the colorspace to RGB (and save) it still fails in IM. I tried unchecking "include CMYK in postscript" - still no go.
So apparently something in the way Photoshop saves an eps file in the RGB format "fixes" the problem.
Now...these eps files (and were talking about several thousand) were originally made for print. Although they are grayscale images - they are all probably in the CMYK colorspace - and would probably need to stay in that colorspace for print (RGB won't fair to well at a printer).
So...I NEED to start with CMYK eps files and get to RGB png files without the font becoming wonky. Note - these are grayscale images so color conversion issues are not a problem. Is there any way with ImageMagick to convert from CMYK to RGB in such a way to retain the shapes of the elements in the image?
(note - I'm off to research this too - I'm sure this NEW question has been answered somewhere).
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
Things NOT working:
Trying to convert the CMYK eps to RGB eps first - then convert eps to png
removed fill option (not really necessary since this ONE image doesn't have a transparent background)
converting to jpg (yea I know - but it was a shot in the dark
(note I will edit with new trials as I come across them)
Trying to convert the CMYK eps to RGB eps first - then convert eps to png
Code: Select all
convert -density 300 -colorspace cmyk figure.eps -fill none -colorspace rgb figure_eps2RGBeps.eps
convert -density 300 figure_eps2RGBeps.eps -fill none figure_RGBeps2png.png
Code: Select all
convert -density 300 -colorspace cmyk figure.eps -colorspace rgb figure_eps2RGBpngREMfill.png
Code: Select all
convert -density 300 -colorspace cmyk figure.eps -colorspace rgb figure_eps2RGBjpg.jpg
Last edited by LadyCygnus on 2014-04-10T12:55:33-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
I am not an expert on eps files nor photoshop or illustrator. However, the verbose information for your figure.eps file shows spot colors with italics fonts. IM does not know how to deal with spot colors. So this may be your issue? It also has a field xmpTPg:HasVisibleTransparency: False that may be causing the white background?
My suspicion is that the default font is italic, since even stripping the meta data to remove the spot fields and doing
shows the same slanted results.
Code: Select all
ps:SpotColor-0: font TimesNewRomanPS-ItalicMT
ps:SpotColor-1: procset Adobe_CoolType_Utility_T42 1.0 0
ps:SpotColor-2: procset Adobe_CoolType_Utility_MAKEOCF 1.23 0
ps:SpotColor-3: procset Adobe_CoolType_Core 2.31 0
ps:SpotColor-4: procset Adobe_AGM_Core 2.0 0
ps:SpotColor-5: procset Adobe_AGM_Utils 1.0 0
ps:SpotColor-6: TimesNewRomanPS-ItalicMT
ps:SpotColor-7: TimesNewRomanPS-ItalicMT
ps:SpotColor-8:
ps:SpotColor-9:
rdf:Alt:
rdf:Bag:
signature: f899856c08b8355c2e7a6bd31a28e634706a2c298928bd5104e7e5f9ef11de27
stDim:h: 70.157471
stDim:unit: Picas
stDim:w: 49.620443
xmp:CreateDate: 2012-01-25T14:05:15-05:00
xmp:CreatorTool: Adobe Illustrator CS5.1
xmpTPg:HasVisibleOverprint: True
xmpTPg:HasVisibleTransparency: False
xmpTPg:NPages: 1
Profiles:
Profile-xmp: 37025 bytes
Artifacts:
filename: figure.eps
verbose: true
Code: Select all
convert -density 300 -colorspace sRGB -background none figure.eps -strip EPS3:figure2.eps
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
LadyCygnus wrote:Things NOT working:
Trying to convert the CMYK eps to RGB eps first - then convert eps to png(note I will edit with new trials as I come across them)Code: Select all
convert -density 300 -colorspace cmyk figure.eps -fill none -colorspace rgb figure_eps2RGBeps.eps convert -density 300 figure_eps2RGBeps.eps -fill none figure_RGBeps2png.png
The proper way to convert vector files from cmyk to rgb (if there are not profiles) is
Code: Select all
convert -density 300 -colorspace sRGB figure.eps figure.png
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
I have the file open in illustrator - there are no spot colors used in the file at all (when I do "select unused swatches" it only comes up with none, registration, white, & black as used). Both white and black are process CMYK. I'm looking at the font and it's TNR Regular 10pt.fmw42 wrote:I am not an expert on eps files nor photoshop or illustrator. However, the verbose information for your figure.eps file shows spot colors with italics fonts. IM does not know how to deal with spot colors. So this may be your issue?
My suspicion is that the default font is italic, since even stripping the meta data to remove the spot fields and doing
shows the same slanted results.Code: Select all
convert -density 300 -colorspace sRGB -background none figure.eps -strip EPS3:figure2.eps
-- I know well that programs can hide stuff...but I'm mightily confused by this.
The "-fill none" part of my convert line was for figures that did have a transparent background - to retain it. I forgot to remove it for this example and it really doesn't matter terribly at this point (maybe at some future point I'll clean the files so they are all the same).It also has a field xmpTPg:HasVisibleTransparency: False that may be causing the white background?
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
PS - I really appreciate the effort you all are making! At least now I have a basis to go on -- and it's one I would have never thought to consider.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
check your eps file in in IM to see the spot colors.
That was how I found the spot colors. But even after I stripped them out, the problem still exists. It could be a bug in IM. I just do not know. It is odd that converting to RGB in PS and saving works, but with a white background. However, converting to sRGB with IM is not keeping the TNR plain and is using italics.
On the other hand, perhaps it is due to an old version of Illustrator, since I can resave as RGB in PS and it works fine.
Do you have a current version of Illustrator?
Code: Select all
convert figure.eps -verbose info:
On the other hand, perhaps it is due to an old version of Illustrator, since I can resave as RGB in PS and it works fine.
Do you have a current version of Illustrator?
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
Original file uploaded to box.com was the original created with Illustrator R15.1 (CS 5)
I've been playing with the file on my computer and at some point saved it using R17 (or CC). I suspect this happened when trying to save as an RGB format in Illustrator. It's still producing the same errors.
Just to verify I saved the file in CC (64-bit)....(and I just opened the wrong adobe product...now crashed illustrator...)
Opening the file and saving in CC didn't help. HOWEVER, opening the file, selecting all, copying, open a NEW file, paste & save does appear to produce a workable file.
I've uploaded the working eps to the box.com account: https://app.box.com/s/9e1wnasg7uld3bw345bv
Interestingly, when running -verbose on it, it still has 6 spot colors, but the three "font" spot colors are gone. I feel like we are inching closer to the actual problem/solution (which hopefully isn't to recreate all these eps files by hand).
I already have a script that reads the MathType eps files and changes one value in them (Euros and MathType don't play well together). I'm tempted to try the same thing with this and find the "code" assigning these values and strip them out. [edit: the only thing in the text portion that comes close to looking like a declaration of a font is in the comments section - so this is probably a dead idea]
I've been playing with the file on my computer and at some point saved it using R17 (or CC). I suspect this happened when trying to save as an RGB format in Illustrator. It's still producing the same errors.
Just to verify I saved the file in CC (64-bit)....(and I just opened the wrong adobe product...now crashed illustrator...)
Opening the file and saving in CC didn't help. HOWEVER, opening the file, selecting all, copying, open a NEW file, paste & save does appear to produce a workable file.
I've uploaded the working eps to the box.com account: https://app.box.com/s/9e1wnasg7uld3bw345bv
Interestingly, when running -verbose on it, it still has 6 spot colors, but the three "font" spot colors are gone. I feel like we are inching closer to the actual problem/solution (which hopefully isn't to recreate all these eps files by hand).
I already have a script that reads the MathType eps files and changes one value in them (Euros and MathType don't play well together). I'm tempted to try the same thing with this and find the "code" assigning these values and strip them out. [edit: the only thing in the text portion that comes close to looking like a declaration of a font is in the comments section - so this is probably a dead idea]
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
There must still be something in the xmp profile, because when I used -strip to remove all the spot parameters, it still did not work.HOWEVER, opening the file, selecting all, copying, open a NEW file, paste & save does appear to produce a workable file.
I've uploaded the working eps to the box.com account: https://app.box.com/s/9e1wnasg7uld3bw345bv
Interestingly, when running -verbose on it, it still has 6 spot colors, but the three "font" spot colors are gone. I feel like we are inching closer to the actual problem/solution (which hopefully isn't to recreate all these eps files by hand).
Profiles:
Profile-xmp: 37025 bytes
-
- Posts: 12
- Joined: 2014-04-10T09:45:00-07:00
- Authentication code: 6789
Re: IM skews font in vector eps files
Just to clarify - this is when you use -strip on the original figure.eps file? When I do that I get a black box, so I'm probably using it wrong.fmw42 wrote:
There must still be something in the xmp profile, because when I used -strip to remove all the spot parameters, it still did not work.
Profiles:
Profile-xmp: 37025 bytes
Code: Select all
convert figure.eps -strip StripTest.eps
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM skews font in vector eps files
This is what I did.
The result looks like the input except for the slanted text. All the spot meta data is gone
Code: Select all
convert -density 300 -colorspace sRGB -background none figure.eps -strip EPS3:figure2.eps
Code: Select all
Image: figure2.eps
Format: PS (PostScript)
Mime type: application/postscript
Class: DirectClass
Geometry: 340x168+0+0
Resolution: 72x72
Print size: 4.72222x2.33333
Units: Undefined
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 16/8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 8995 (0.137255)
max: 65535 (1)
mean: 63359 (0.966797)
standard deviation: 10106.9 (0.154221)
kurtosis: 21.3809
skewness: -4.75065
Green:
min: 7967 (0.121569)
max: 65535 (1)
mean: 63319.5 (0.966194)
standard deviation: 10289.7 (0.157011)
kurtosis: 21.384
skewness: -4.75073
Blue:
min: 8224 (0.12549)
max: 65535 (1)
mean: 63329 (0.966339)
standard deviation: 10246.1 (0.156346)
kurtosis: 21.3728
skewness: -4.75
Alpha:
min: 0 (0)
max: 65535 (1)
mean: 3432.79 (0.052381)
standard deviation: 14600.8 (0.222794)
kurtosis: 14.1462
skewness: -4.01823
Image statistics:
Overall:
min: 0 (0)
max: 65535 (1)
mean: 63027.5 (0.961737)
standard deviation: 11469.5 (0.175013)
kurtosis: 20.1793
skewness: -4.63951
Alpha: srgba(255,255,255,0) #FFFFFFFFFFFF0000
Colors: 16
Histogram:
1374: ( 8995, 7967, 8224,65535) #23231F1F2020 srgba(35,31,32,1)
151: (12850,11822,12079,65535) #32322E2E2F2F srgba(50,46,47,1)
99: (16448,15677,15934,65535) #40403D3D3E3E srgba(64,61,62,1)
102: (20303,19532,19789,65535) #4F4F4C4C4D4D srgba(79,76,77,1)
132: (24158,23387,23387,65535) #5E5E5B5B5B5B srgba(94,91,91,1)
41: (27756,27242,27242,65535) #6C6C6A6A6A6A srgba(108,106,106,1)
115: (31611,31097,31097,65535) #7B7B79797979 srgba(123,121,121,1)
285: (35466,34952,34952,65535) #8A8A88888888 srgba(138,136,136,1)
62: (39064,38550,38807,65535) #989896969797 srgba(152,150,151,1)
98: (42919,42405,42662,65535) #A7A7A5A5A6A6 srgba(167,165,166,1)
71: (46774,46260,46517,65535) #B6B6B4B4B5B5 srgba(182,180,181,1)
148: (50372,50115,50372,65535) #C4C4C3C3C4C4 srgba(196,195,196,1)
98: (54227,53970,53970,65535) #D3D3D2D2D2D2 srgba(211,210,210,1)
89: (58082,57825,57825,65535) #E2E2E1E1E1E1 srgba(226,225,225,1)
127: (61680,61680,61680,65535) #F0F0F0F0F0F0 grey94
54128: (65535,65535,65535, 0) #FFFFFFFFFFFF0000 srgba(255,255,255,0)
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 340x168+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2014-04-10T22:13:45-07:00
date:modify: 2014-04-10T22:13:45-07:00
ps:HiResBoundingBox: 340.08x168.24+0+0
ps:Level: Adobe-3.0 EPSF-3.0
signature: 93aa4c46985251039a578c5a945b8f8966d65499e5c5df2818de4087abedfee1
Artifacts:
filename: figure2.eps
verbose: true
Tainted: False
Filesize: 6.96KB
Number pixels: 57.1K
Pixels per second: 0B
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.8.8-10 Q16 x86_64 2014-03-28 http://www.imagemagick.org