Converting PCL to TIFF

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
GeneralHQ
Posts: 26
Joined: 2008-07-16T08:01:02-07:00

Converting PCL to TIFF

Post by GeneralHQ »

We have been using ImageMagick successfully for some time now to convert TIFF images to PCL, using the Magick++ interface.

Now we are trying to do the opposite - take PCL data and convert them to TIFF images. However, whenever I try to read the PCL data in, I am getting an error.

First I create the PCL data in memory, then create a blob with that data. The error occurs when I execute an Image.read(blob) instruction, where I get an exception saying "ImageMagick: PCL delegate failed".

My question is, does ImageMagick allow me to do what I am trying to do? Can I use PCL data as input to create an ImageMagick image? If it does have that capability, what could be causing this error?

Thanks,
Robert
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Converting PCL to TIFF

Post by magick »

Some image formats in ImageMagick require external delegate programs to work. To interpret PCL, you must first install GhostPCL.
GeneralHQ
Posts: 26
Joined: 2008-07-16T08:01:02-07:00

Re: Converting PCL to TIFF

Post by GeneralHQ »

Thank you. That seems to have gotten me most of the way there, but I still have one (well, two) more question(s).

I have downloaded and installed GhostPCL and seem to have it working to get ImageMagick to now read my PCL data to do the conversion needed.

The problem I am facing now is that the conversion is done at 72 dpi, which is a very low resolution. I would like it to be read in at 300 dpi. This appears to be done when I do my "Image.read( blob ) ;" command.

Looking at the ImageMagick delegates.xml file, I see a line to take PCL images and specify PCL6.exe (ie GhostPCL) along with a bunch of parameters to handle these files. One of the parameters is "-r%s". It is that %s that is apparently gets replaced by ImageMagick with "72x72". If I edit that line and replace it with "r=300x300 -sfoo=%s", it seems to work as I would like, by specifying 300 for the resoultion, then a garbage parameter -sfoo= to absorb and ignore the 72x72 that ImageMagick will replace the next %s with.

My question is ... How do I get ImageMagick to specify 300x300 instead of 72x72 as the -r parameter value used to invoke GhostPCL, so that I don't have to edit the delegates.xml file with this hack? What setting am I missing in ImageMagick that specifies that resolution value?

Also, when I do the Image.read( blob ) command, I am getting a warning thrown from ImageMagick saying "unknown field with tag 292 (0x124) encountered. 'TIFFReadDirectory'". That warning seems to be normal and the rest of the code works fine if I ignore it, but I was curious why I am getting that warning and if there is a way I can get rid of it.

Thanks,
Robert.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Converting PCL to TIFF

Post by magick »

Use density() to set the resolution before you read your PCL image.
GeneralHQ
Posts: 26
Joined: 2008-07-16T08:01:02-07:00

Re: Converting PCL to TIFF

Post by GeneralHQ »

Thank you. The density() was just the tip I needed. And let me also say that you all run a great forum here. Very helpful and professional with fast and accurate answers. Thank you so much for that.

One last issue, and then I think I've got it all my code working right.

The TIFF image I'm creating has Tag 262 - Photometric Interpretation - set to 1, and for our system we'd like to have it set to 0. How do I do that, using the Magick++ interface?

I see documenation on the convert command referencing -define quantum:polarity=min-is-white or min-is-black ... to set it using the convert command line tool, but I'm using the Magick++ interface, not a command line interface.

Thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Converting PCL to TIFF

Post by magick »

Use defineValue().
GeneralHQ
Posts: 26
Joined: 2008-07-16T08:01:02-07:00

Re: Converting PCL to TIFF

Post by GeneralHQ »

What paramters am I supposed to give to defineValue()?

I tried:
image.defineValue( "quantum:polarity", "min-is-white" ) ;
image.defineValue( "262", "0" ) ;
image.defineValue( "TIFF", "quantum:polarity", "min-is-white") ;
image.DefineValue( image.magick(), "quantum:polarity", "min-is-white");
and several other combinations thereof.

and no joy.
Last edited by GeneralHQ on 2009-10-13T11:49:56-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Converting PCL to TIFF

Post by magick »

Use image.defineValue( "quantum", "polarity", "min-is-black" ) .
GeneralHQ
Posts: 26
Joined: 2008-07-16T08:01:02-07:00

Re: Converting PCL to TIFF

Post by GeneralHQ »

THANK YOU!!! That is exactly what I needed to know.

I actually used 'min-is-white' (not 'min-is-black') as the third parameter to get the results I was looking for, but it works great.

I am now making TIFF images from the PCL exactly as I need them to be.

Thanks again. You guys are great!
lamantin

Re: Converting PCL to TIFF

Post by lamantin »

Hi,

I am really starter with Image Magick, I only found this program while i was google for my problem.
My problem to solve is to calculate the ink-usage (let's say ink coverage) of printing jobs (PCL5-PCL6). Could it be possible to convert PCL job to TIFF for example, and to gain the the black, magenta, yellow, cyan coverage?

Could somebody give a detailed description how to do this, and which "functions" of ImageMagick should I learn to use it.

Thank you in advance!
Post Reply