Question about PostScript conversion

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
arutsuro88
Posts: 2
Joined: 2018-04-24T06:20:27-07:00
Authentication code: 1152

Question about PostScript conversion

Post by arutsuro88 »

I want to know how can I force that the conversion to a PostScript file, be done with DirectClass and No compression.
(DirectClass=0) and (Compression=none=0).

Thank you in advance for your help.

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

Re: Question about PostScript conversion

Post by snibgo »

I don't think IM can write images to PDF with no compression. But you can make a palette but not compressed tiff image, then use tiff2pdf:

Code: Select all

convert toes.png -type palette -compress None x.tiff

tiff2pdf -o out.pdf -d x.tiff
EDIT: Sorry, I misread the question. It is about PS, not PDF.
snibgo's IM pages: im.snibgo.com
arutsuro88
Posts: 2
Joined: 2018-04-24T06:20:27-07:00
Authentication code: 1152

Re: Question about PostScript conversion

Post by arutsuro88 »

Thank you for your answer. Please let me explain you what I am trying to get.
When using magick for file conversión from .jpg to .ps (PostScript), magick includes a set of routines in PostScript for handling several cases of image printing.
I want to get the smallest set of PostScript instructions that can show in a printer a.jpg with only grayscale information, because the printer
hasn´t color.

I got that smaller set

/DisplayImage {gsave /buffer 512 string def /byte 1 string def /color_packet 3 string def /pixels 768 string def currentfile buffer readline pop token pop /x exch
def token pop /y exch def pop x y translate currentfile buffer readline pop token pop /x exch def token pop /y exch def pop x y scale currentfile buffer readline
pop token pop /columns exch def token pop /rows exch def pop columns rows 8 [ columns 0 0 rows neg 0 rows ] { currentfile color_packet readhexstring pop pop
color_packet 0 get 0.299 mul color_packet 1 get 0.587 mul add color_packet 2 get 0.114 mul add cvi /gray_packet exch def /number_pixels 1 def 0 1 number_pixels 1
sub { pixels exch gray_packet put } for pixels 0 number_pixels getinterval } image grestore }bind def

But this one works with class=DirectClass, and compression=No compression. (One needs to go to the .ps file and erase the two lines with 0, before
the lines that had the content of the image.)


I have two different .jpg files, let call them 1, and 2

magick identify 1.jpg
1.jpg JPEG 279x168 279x168+0+0 8-bit sRGB 21286B 0.000u 0:00.000
magick 1.jpg 1.ps
edit 1.ps
......
DisplayImage
0 0
209.25 126
12
279 168
0
0
FFFEFBFFFFFDFCFFFFFBFFFFFFFEFFFFFDFFFFFDFFFFFEFBFFFFFBFFFFFBFFFDFFFFFEFFF9FFFF
........

magick identify 2.jpg
2.jpg JPEG 1056x620 1056x620+0+0 8-bit sRGB 95835B 0.000u 0:00.000
magick 2.jpg 2.ps

edit 2.ps
.......
DisplayImage
0 0
253.44 148.8
12
1056 620
1
1
1
8
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
........

Both files 1 and 2 are .jpg with 8-bit sRGB, but the first use of magick with 1 give me a Class=DirectClass and Compression= No compression, that is what I wanted, but the second use of magick with 2, give me a Class=PseudoClass , and Compression=true.

Why a conversion from .jpg to .ps with the same type of .jpg generates different formats.?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Question about PostScript conversion

Post by snibgo »

Sorry, I misread the question. It is about Postscript, not PDF. I know nothing about PS.
snibgo's IM pages: im.snibgo.com
Post Reply