Page 1 of 1
Color profiles and fonts for embedded text
Posted: 2015-11-09T10:26:44-07:00
by WasabiSailor
I am using ImageMagick via the command line for a client to convert EPS and PSD images. For the PSD images, we are selecting different layers and creating new, flat JPEG images from the PSD layers using the convert tool. What my client wants me to do is to be able to explain how the color profiles with when there is a profile embedded in the PSD image and how to ensure that the text layers are bold instead of standard fonts. It looks like the -font and -profile options only work for color profile files and the fonts of text passed in from the command line. Is there a way to ensure that an embedded profile and font can be changed or used?
Re: Color profiles and fonts for embedded text
Posted: 2015-11-09T11:39:25-07:00
by fmw42
IM does not know about text fonts in PSD or EPS files, as far as I know. I suppose the information is in the EPS and PSD file. However, it only treats files as raster data. Vector files such as EPS are converted to raster pixel data. So I do not think you can change fonts or make text bolder. You can detect and change profiles, however, with the -profile command. See
http://www.imagemagick.org/Usage/formats/#vector
http://www.imagemagick.org/Usage/formats/#profiles
http://www.imagemagick.org/script/escape.php
Re: Color profiles and fonts for embedded text
Posted: 2015-11-09T12:47:47-07:00
by online_p
Would the absence of the correct font on the system prevent ImageMagick from rasterizing the font layer correctly?
Re: Color profiles and fonts for embedded text
Posted: 2015-11-09T12:52:41-07:00
by fmw42
That could be especially for the EPS, but only as far a reading the the font, not changing it. IM cannot change fonts as far as I know. But I am not an expert on that. Have you tried downloading the needed font and see if that makes a difference.
What is your IM version and platform?
If you are having a specific issue, perhaps you can post the image to some free hosting service such as dropbox.com and put the URL here. Then post your command line and explain what is wrong with the output.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-10T14:57:36-07:00
by WasabiSailor
Version: ImageMagick 6.9.1-4 Q16 x86_64 2015-08-06
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib fontconfig freetype jng jpeg lcms lzma pangocairo png tiff x xml zlib
The platform it is running on is Linux.
The issue is that the client I am working for wants to apply color profiles at will and some PSD images will have color profiles and some may not. Then want to easily manage which color profile they are using and also want to know for certain how IM handles color profiles and text attributes with embedded text layers.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-10T18:28:24-07:00
by fmw42
The issue is that the client I am working for wants to apply color profiles at will and some PSD images will have color profiles and some may not. Then want to easily manage which color profile they are using and also want to know for certain how IM handles color profiles and text attributes with embedded text layers.
As far as I know, IM does not know about text layers as text. I assume they get rasterized in IM so the text information such as font, etc is lost.
As for the profiles, that IM can handle. You need to use the string formats/escapes to detect what profile is in the image. Then use -profile (one or two of them to either change or reassign if it is not included).
see
http://www.imagemagick.org/script/escape.php
Regarding the string escapes:
%[profile:icc] ICC profile info
%[profile:icm] ICM profile info
%[profiles] list of any embedded profiles
for example
Code: Select all
convert image -format "%[profiles]" info:
will list any of the types of profiles in the images. Use the others to determine the exact profile name
and see
http://www.imagemagick.org/Usage/formats/#profiles
regarding the profile changes.
If the image has a profile already, then just do
Code: Select all
convert image -profile path2/someprofile result
to change the profile to a new profile.
If the image does not have a profile or you use -strip to remove the profile, then you have to specify a new profile for the image depending upon the colorspace (sRGB or CMYK) and then change it
Code: Select all
convert image -profile path2/profile1 -profile path2/profile2 result
where profile1 is picked depending upon the image colorspace and profile2 is picked as desired for the new profile.
So you need write a short script to check the profile(s) escape and the colorspace escape and determine if you need one or two profiles and then use an conditional to specify the IM convert command line.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T06:58:40-07:00
by WasabiSailor
fmw42, I understand all of that. I was wondering if there was a better way to do it than that and the client wants 100% verification of how it all works. I could not find a way to select or use profiles embedded in the image and it looks like not. I've told them that we need a profile file if they want to always apply a given profile. It may be easiest to just get the profile they want in a file then always apply that profile when converting an image rather than adding the steps of checking to see if it exists and then changing the command line based on that.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T07:23:54-07:00
by snibgo
WasabiSailor wrote:I could not find a way to select or use profiles embedded in the image and it looks like not.
If a file has an embedded profile, you can extract it, eg:
Then you can use out.icc wherever you want.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T07:25:24-07:00
by WasabiSailor
Thanks.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T10:03:47-07:00
by fmw42
snibgo wrote:
If a file has an embedded profile, you can extract it, eg:
Then you can use out.icc wherever you want.
What if the embedded profile is icm? Don't you need to use the %[profiles] to find out which one it is first or even if there is one or not?
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T10:33:12-07:00
by fmw42
Also if the profile is in the image, then why do you need to extract it? You just need to use one -profile with the new profile you desire to change to.
The only reason for needing to extract it is if you do not have that profile and want to strip all the meta data from the image. Then you would need to extract the profile, strip the image, then use two profiles (the one extracted followed by the new one you want to have for the output image). I have shown how to do that above by testing for profiles and then using one or two profiles to convert the image.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T10:38:28-07:00
by fmw42
Perhaps snibgo's suggestion to extract the profile would make sense if you want to confirm that the output has that profile. But you can also do that by using the %[profiles] and %[profile] escapes on the output image.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T10:38:56-07:00
by WasabiSailor
This client is rather particular. I think they've decided how to deal with this now. Some of their images have a color profile and some don't. They wanted to make sure how it worked and what could be done to ensure that a profile was applied to every image. They have decided to handle this post conversion now because they want to be subjective in the application and that is hard to do in code.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T10:50:33-07:00
by snibgo
I've never played with icm profiles. I seem to recall they are the same as icc, just with a different name, but I could be wrong.
Extracting colour profiles from images doesn't seem very useful to me, but WasabiSailor seemed to want it, and it is possible.
Images with RedGreenBlue channels and no profile are generally assumed to be sRGB. CMYK files with no profile are more problematic.
Re: Color profiles and fonts for embedded text
Posted: 2015-11-11T11:17:08-07:00
by fmw42
I did not know if they were different or not. But looking into it and according to
http://www.xrite.com/ezcolor/support/kb2994, they are the same, but icm is used by Microsoft vs icc for other systems.