Clarity problem on Solaris when converting from PDF to JPEG
Posted: 2011-07-21T14:07:59-07:00
When a PDF file is converted by ImageMagick-6.6.7-Q16 on Windows XP, the fonts in the JPEG file is sharp and not blurry when displayed on a browser. However, when the same PDF file is converted by /usr/local/lib/ImageMagick-6.6.7 on Solaris (i386-pc-solaris2.10), the fonts in the JPEG file is blurry. This is the command that was used:
convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpg
The attribute -colorspace RGB is needed because we need to support PDF file that uses CYMK, and IE browser can not display JPEG images with CYMK.
----------
On Windows XP, the convert command uses PPM - portable pixmap format (raster-graphics formats) with device pnmraw.
C:\Program Files\ImageMagick-6.6.7-Q16>convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpeg
[ghostscript library] Files/gs/gs9.01/bin/gsdll32.dll" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextA
lphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa" "-fC:/DOCUME~1/slau/LOCALS~1/Temp/magick-saRecNKn" "-fC:/DOCUME~1/slau/LOCALS~1/Temp/magick-
yHIqm59A"C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[0] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.172u 0:00.219
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[1] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.141u 0:00.188
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[2] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.094u 0:00.141
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[3] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.063u 0:00.110
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[4] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.031u 0:00.078
test_file.pdf[0] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[1] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[2] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[3] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[4] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.030
test_file.pdf=>test_file-0.jpeg[0] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 442KB 0.094u 0:00.235
test_file.pdf=>test_file-1.jpeg[1] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 459KB 0.188u 0:00.343
test_file.pdf=>test_file-2.jpeg[2] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 426KB 0.266u 0:00.421
test_file.pdf=>test_file-3.jpeg[3] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 410KB 0.344u 0:00.515
test_file.pdf=>test_file-4.jpeg[4] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 131KB 0.406u 0:00.563
----------
On Solaris Sun OS, the convert command uses PNG - Portable Network Graphics with device pngalpha.
-bash-3.00$ convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpg
"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=/var/tmp/magick-WyEJaaXg-%08d" "-f/var/tmp/magick-oLDJaaXg" "-f/var/tmp/magick-OjCJaaXg"
/var/tmp/magick-WyEJaaXg-00000001 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 177KB 0.090u 0:00.150
/var/tmp/magick-WyEJaaXg-00000002 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 181KB 0.090u 0:00.099
/var/tmp/magick-WyEJaaXg-00000003 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 181KB 0.100u 0:00.090
/var/tmp/magick-WyEJaaXg-00000004 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 176KB 0.090u 0:00.099
/var/tmp/magick-WyEJaaXg-00000005 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 66.5KB 0.080u 0:00.080
test_file.pdf[0] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.370u 0:00.370
test_file.pdf[1] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.280u 0:00.270
test_file.pdf[2] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.180u 0:00.179
test_file.pdf[3] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.080u 0:00.080
test_file.pdf[4] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.000u 0:00.000
test_file.pdf=>test_file-0.jpg[0] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 492KB 0.130u 0:00.169
test_file.pdf=>test_file-1.jpg[1] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 524KB 0.250u 0:00.289
test_file.pdf=>test_file-2.jpg[2] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 492KB 0.370u 0:00.410
test_file.pdf=>test_file-3.jpg[3] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 459KB 0.490u 0:00.529
test_file.pdf=>test_file-4.jpg[4] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 147KB 0.580u 0:00.619
----------
I tried making GhostScript using the same -sDEVICE as in Windows XP on Solaris, but it generated the below error:
-bash-3.00$ gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pnmraw -r150x150 -o test_file_%03d.jpeg test_file.pdf
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in (test_file.pdf)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1165/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 9.01: Unrecoverable error, exit code 1
----------
Next, I tried making GhostScript use -sDEVICE=jpeg -dJPEGQ=95 and that worked from command line and the fonts look sharper.
-bash-3.00$ gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=95 -r150x150 -o test_file_%03d.jpeg test_file.pdf
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 5.
Page 1
Scanning /usr/local/share/ghostscript/fonts for fonts... 173 files, 41 scanned, 35 new fonts.
Substituting font Times-Bold for Times New Roman,Bold.
Loading NimbusRomNo9L-Medi font from /usr/local/share/ghostscript/fonts/n021004l.pfb... 2604440 1266666 1659520 360105 3 done.
Substituting font Times-Roman for Times New Roman.
Loading NimbusRomNo9L-Regu font from /usr/local/share/ghostscript/fonts/n021003l.pfb... 2664728 1329326 1699712 392599 3 done.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Loading ArialMT font from /usr/openwin/lib/X11/fonts/TrueType/Arial.ttf... 2798928 1431228 2650992 1159377 3 done.
Substituting font Times-Bold for Times New Roman,BoldItalic.
Substituting font Times-Roman for Times New Roman,Italic.
Page 2
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Substituting font Times-Roman for Times New Roman,Italic.
Page 3
Substituting font Times-Roman for Times New Roman,Italic.
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Page 4
Substituting font Times-Roman for Times New Roman,Italic.
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Page 5
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
----------
However, when I modified the /usr/local/lib/ImageMagick-6.6.7/config/delegates.xml and replace:
<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
with:
<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=jpeg" -dJPEGQ=95 -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
and executed the following imageMagick convert command, a deadlock error resulted:
-bash-3.00$ convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpeg
"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=jpeg" -dJPEGQ=95 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=/var/tmp/magick-6_9LaGSy-%08d" "-f/var/tmp/magick-Oe8LaGSy" "-f/var/tmp/magick-_h7LaGSy"
convert: unable to lock semaphore `Deadlock situation detected/avoided' @ fatal/semaphore.c/LockSemaphoreInfo/273.
----------
How can I get ImageMagick/GhostScript to use the proper -sDEVICE so that the fonts in the JPEG will become sharper? We have installed GhostScript font files (*.afm, *.pfb,*gsf) in the directory /usr/local/share/ghostscript/fonts. Do you think one of the problem is due to GhostScipt font search path has "/usr/openwin/lib/X11/fonts/Type1" and "/usr/openwin/lib/X11/fonts/TrueType" so GhostScript is picking up the wrong X11 fonts that cannot be displayed clearly on a web browser? I have asked IT to regenerate the GhostScript Makefile by running autconf (autogen.sh) with the option: --disable-fontconfig but IT tells me they still see the opewin X11 paths in the GhostScript font search path after rebuild. Anyone has any ideas why? Thanks.
----------
GhostScript font search path at the bottom:
-bash-3.00$ gs -h
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11
Available devices:
alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500
cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cdnj500 cfax
cgm24 cgm8 cgmmono chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl
cp50 declj250 deskjet devicen dfaxhigh dfaxlow dj505j djet500 djet500c
dl2100 dnj650c epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900
epl6100 epl6200 eplcolor eplmono eps9high eps9mid epson epsonc epswrite
escp escpage faxg3 faxg32d faxg4 fmlbp fmpr fs600 gdi hl1240 hl1250 hl7x0
hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510
hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c
hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus hpdjportable ibmpro
ijs imagen imdi inferno iwhi iwlo iwlq jetp3852 jj100 jpeg jpegcmyk
jpeggray la50 la70 la75 la75plus laserjet lbp310 lbp320 lbp8 lex2050
lex3200 lex5700 lex7000 lips2p lips3 lips4 lips4v lj250 lj3100sw lj4dith
lj4dithp lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d ljet4pjl
ljetplus ln03 lp1800 lp1900 lp2000 lp2200 lp2400 lp2500 lp2563 lp3000c
lp7500 lp7700 lp7900 lp8000 lp8000c lp8100 lp8200c lp8300c lp8300f
lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c lp8900 lp9000b lp9000c
lp9100 lp9200b lp9200c lp9300 lp9400 lp9500c lp9600 lp9600s lp9800c
lps4500 lps6500 lq850 lx5000 lxm3200 lxm5700m m8510 mag16 mag256 md1xMono
md2k md50Eco md50Mono md5k mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono
miff24 mj500c mj6000c mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050
oki182 oki4w okiibm oprp opvp paintjet pam pbm pbmraw pcl3 pcx16 pcx24b
pcx256 pcx2up pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw
photoex picty180 pj pjetxl pjxl pjxl300 pkm pkmraw pksm pksmraw plan9bm
png16 png16m png256 png48 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw
pr1000 pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb psgray psmono psrgb
pswrite pxlcolor pxlmono r4081 rinkj rpdl samsunggdi sgirgb sj48 spotcmyk
st800 stcolor sunhmono t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc
tiff32nc tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray
tifflzw tiffpack tiffscaled tiffsep tiffsep1 uniprint wtscmyk wtsimdi x11
x11alpha x11cmyk x11cmyk2 x11cmyk4 x11cmyk8 x11gray2 x11gray4 x11mono
x11rg16x x11rg32x xcf xes
Search path:
/usr/local/share/ghostscript/fonts : %rom%Resource/Init/ : %rom%lib/ :
/usr/local/share/ghostscript/9.01/Resource/Init :
/usr/local/share/ghostscript/9.01/lib :
/usr/local/share/ghostscript/9.01/Resource/Font :
/usr/local/share/ghostscript/fonts :
/usr/local/share/fonts/default/ghostscript :
/usr/local/share/fonts/default/Type1 :
/usr/local/share/fonts/default/TrueType : /usr/lib/DPS/outline/base :
/usr/openwin/lib/X11/fonts/Type1 : /usr/openwin/lib/X11/fonts/TrueType
convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpg
The attribute -colorspace RGB is needed because we need to support PDF file that uses CYMK, and IE browser can not display JPEG images with CYMK.
----------
On Windows XP, the convert command uses PPM - portable pixmap format (raster-graphics formats) with device pnmraw.
C:\Program Files\ImageMagick-6.6.7-Q16>convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpeg
[ghostscript library] Files/gs/gs9.01/bin/gsdll32.dll" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextA
lphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa" "-fC:/DOCUME~1/slau/LOCALS~1/Temp/magick-saRecNKn" "-fC:/DOCUME~1/slau/LOCALS~1/Temp/magick-
yHIqm59A"C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[0] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.172u 0:00.219
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[1] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.141u 0:00.188
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[2] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.094u 0:00.141
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[3] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.063u 0:00.110
C:/DOCUME~1/slau/LOCALS~1/Temp/magick-KrQzQcSa[4] PPM 1275x1650 1275x1650+0+0 8-bit Grayscale DirectClass 31.56MB 0.031u 0:00.078
test_file.pdf[0] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[1] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[2] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[3] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.014
test_file.pdf[4] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 31.56MB 0.016u 0:00.030
test_file.pdf=>test_file-0.jpeg[0] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 442KB 0.094u 0:00.235
test_file.pdf=>test_file-1.jpeg[1] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 459KB 0.188u 0:00.343
test_file.pdf=>test_file-2.jpeg[2] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 426KB 0.266u 0:00.421
test_file.pdf=>test_file-3.jpeg[3] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 410KB 0.344u 0:00.515
test_file.pdf=>test_file-4.jpeg[4] PDF 1275x1650 1275x1650+0+0 16-bit Grayscale DirectClass 131KB 0.406u 0:00.563
----------
On Solaris Sun OS, the convert command uses PNG - Portable Network Graphics with device pngalpha.
-bash-3.00$ convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpg
"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=/var/tmp/magick-WyEJaaXg-%08d" "-f/var/tmp/magick-oLDJaaXg" "-f/var/tmp/magick-OjCJaaXg"
/var/tmp/magick-WyEJaaXg-00000001 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 177KB 0.090u 0:00.150
/var/tmp/magick-WyEJaaXg-00000002 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 181KB 0.090u 0:00.099
/var/tmp/magick-WyEJaaXg-00000003 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 181KB 0.100u 0:00.090
/var/tmp/magick-WyEJaaXg-00000004 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 176KB 0.090u 0:00.099
/var/tmp/magick-WyEJaaXg-00000005 PNG 1275x1650 1275x1650+0+0 8-bit DirectClass 66.5KB 0.080u 0:00.080
test_file.pdf[0] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.370u 0:00.370
test_file.pdf[1] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.280u 0:00.270
test_file.pdf[2] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.180u 0:00.179
test_file.pdf[3] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.080u 0:00.080
test_file.pdf[4] PDF 1275x1650 1275x1650+0+0 16-bit DirectClass 177KB 0.000u 0:00.000
test_file.pdf=>test_file-0.jpg[0] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 492KB 0.130u 0:00.169
test_file.pdf=>test_file-1.jpg[1] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 524KB 0.250u 0:00.289
test_file.pdf=>test_file-2.jpg[2] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 492KB 0.370u 0:00.410
test_file.pdf=>test_file-3.jpg[3] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 459KB 0.490u 0:00.529
test_file.pdf=>test_file-4.jpg[4] PDF 1275x1650 1275x1650+0+0 16-bit Bilevel DirectClass 147KB 0.580u 0:00.619
----------
I tried making GhostScript using the same -sDEVICE as in Windows XP on Solaris, but it generated the below error:
-bash-3.00$ gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pnmraw -r150x150 -o test_file_%03d.jpeg test_file.pdf
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in (test_file.pdf)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1165/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 9.01: Unrecoverable error, exit code 1
----------
Next, I tried making GhostScript use -sDEVICE=jpeg -dJPEGQ=95 and that worked from command line and the fonts look sharper.
-bash-3.00$ gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=95 -r150x150 -o test_file_%03d.jpeg test_file.pdf
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 5.
Page 1
Scanning /usr/local/share/ghostscript/fonts for fonts... 173 files, 41 scanned, 35 new fonts.
Substituting font Times-Bold for Times New Roman,Bold.
Loading NimbusRomNo9L-Medi font from /usr/local/share/ghostscript/fonts/n021004l.pfb... 2604440 1266666 1659520 360105 3 done.
Substituting font Times-Roman for Times New Roman.
Loading NimbusRomNo9L-Regu font from /usr/local/share/ghostscript/fonts/n021003l.pfb... 2664728 1329326 1699712 392599 3 done.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Loading ArialMT font from /usr/openwin/lib/X11/fonts/TrueType/Arial.ttf... 2798928 1431228 2650992 1159377 3 done.
Substituting font Times-Bold for Times New Roman,BoldItalic.
Substituting font Times-Roman for Times New Roman,Italic.
Page 2
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Substituting font Times-Roman for Times New Roman,Italic.
Page 3
Substituting font Times-Roman for Times New Roman,Italic.
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Page 4
Substituting font Times-Roman for Times New Roman,Italic.
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
Page 5
Substituting font Times-Roman for Times New Roman.
Substituting font Times-Bold for Times New Roman,Bold.
----------
However, when I modified the /usr/local/lib/ImageMagick-6.6.7/config/delegates.xml and replace:
<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
with:
<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=jpeg" -dJPEGQ=95 -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
and executed the following imageMagick convert command, a deadlock error resulted:
-bash-3.00$ convert -verbose -density 150 -colorspace RGB test_file.pdf test_file.jpeg
"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=jpeg" -dJPEGQ=95 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=/var/tmp/magick-6_9LaGSy-%08d" "-f/var/tmp/magick-Oe8LaGSy" "-f/var/tmp/magick-_h7LaGSy"
convert: unable to lock semaphore `Deadlock situation detected/avoided' @ fatal/semaphore.c/LockSemaphoreInfo/273.
----------
How can I get ImageMagick/GhostScript to use the proper -sDEVICE so that the fonts in the JPEG will become sharper? We have installed GhostScript font files (*.afm, *.pfb,*gsf) in the directory /usr/local/share/ghostscript/fonts. Do you think one of the problem is due to GhostScipt font search path has "/usr/openwin/lib/X11/fonts/Type1" and "/usr/openwin/lib/X11/fonts/TrueType" so GhostScript is picking up the wrong X11 fonts that cannot be displayed clearly on a web browser? I have asked IT to regenerate the GhostScript Makefile by running autconf (autogen.sh) with the option: --disable-fontconfig but IT tells me they still see the opewin X11 paths in the GhostScript font search path after rebuild. Anyone has any ideas why? Thanks.
----------
GhostScript font search path at the bottom:
-bash-3.00$ gs -h
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11
Available devices:
alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500
cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cdnj500 cfax
cgm24 cgm8 cgmmono chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl
cp50 declj250 deskjet devicen dfaxhigh dfaxlow dj505j djet500 djet500c
dl2100 dnj650c epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900
epl6100 epl6200 eplcolor eplmono eps9high eps9mid epson epsonc epswrite
escp escpage faxg3 faxg32d faxg4 fmlbp fmpr fs600 gdi hl1240 hl1250 hl7x0
hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510
hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c
hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus hpdjportable ibmpro
ijs imagen imdi inferno iwhi iwlo iwlq jetp3852 jj100 jpeg jpegcmyk
jpeggray la50 la70 la75 la75plus laserjet lbp310 lbp320 lbp8 lex2050
lex3200 lex5700 lex7000 lips2p lips3 lips4 lips4v lj250 lj3100sw lj4dith
lj4dithp lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d ljet4pjl
ljetplus ln03 lp1800 lp1900 lp2000 lp2200 lp2400 lp2500 lp2563 lp3000c
lp7500 lp7700 lp7900 lp8000 lp8000c lp8100 lp8200c lp8300c lp8300f
lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c lp8900 lp9000b lp9000c
lp9100 lp9200b lp9200c lp9300 lp9400 lp9500c lp9600 lp9600s lp9800c
lps4500 lps6500 lq850 lx5000 lxm3200 lxm5700m m8510 mag16 mag256 md1xMono
md2k md50Eco md50Mono md5k mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono
miff24 mj500c mj6000c mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050
oki182 oki4w okiibm oprp opvp paintjet pam pbm pbmraw pcl3 pcx16 pcx24b
pcx256 pcx2up pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw
photoex picty180 pj pjetxl pjxl pjxl300 pkm pkmraw pksm pksmraw plan9bm
png16 png16m png256 png48 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw
pr1000 pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb psgray psmono psrgb
pswrite pxlcolor pxlmono r4081 rinkj rpdl samsunggdi sgirgb sj48 spotcmyk
st800 stcolor sunhmono t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc
tiff32nc tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray
tifflzw tiffpack tiffscaled tiffsep tiffsep1 uniprint wtscmyk wtsimdi x11
x11alpha x11cmyk x11cmyk2 x11cmyk4 x11cmyk8 x11gray2 x11gray4 x11mono
x11rg16x x11rg32x xcf xes
Search path:
/usr/local/share/ghostscript/fonts : %rom%Resource/Init/ : %rom%lib/ :
/usr/local/share/ghostscript/9.01/Resource/Init :
/usr/local/share/ghostscript/9.01/lib :
/usr/local/share/ghostscript/9.01/Resource/Font :
/usr/local/share/ghostscript/fonts :
/usr/local/share/fonts/default/ghostscript :
/usr/local/share/fonts/default/Type1 :
/usr/local/share/fonts/default/TrueType : /usr/lib/DPS/outline/base :
/usr/openwin/lib/X11/fonts/Type1 : /usr/openwin/lib/X11/fonts/TrueType