Skip to main content
Question

Converting PDFs to JPGs


klingdom
Contributor
Forum|alt.badge.img+5

Hello,

I continue to have trouble converting PDFs to JPGs!  I am/have been followed the instruction on:

but keep getting errors on the Writer. 

JPEG writer: This format cannot support more than 3 bands.  Please remove the extra bands and try again
JPEG writer: An error has occurred. Check the logfile above for details

 

How do I find out the number of Bands as they pertain to ImageRasterizer’s Raster Properties Number of Columns and Number of Rows??  Or is there another way??

 

Thx

Brian

7 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • February 21, 2024

Hello @klingdom,

Based on the error you’re seeing, the rasterized output from the PDF reader is RGBA32, which the JPEG writer cannot handle as this format does not support alpha bands.

Use a RasterInterpretationCoercer and set the Destination Interpretation Type parameter to “RGB24”, and choose to either apply or drop the alpha band in the RGBA to RGB parameter.

I hope this helps.


danilo_fme
Evangelist
Forum|alt.badge.img+42
  • Evangelist
  • February 22, 2024
debbiatsafe wrote:

Hello @klingdom,

Based on the error you’re seeing, the rasterized output from the PDF reader is RGBA32, which the JPEG writer cannot handle as this format does not support alpha bands.

Use a RasterInterpretationCoercer and set the Destination Interpretation Type parameter to “RGB24”, and choose to either apply or drop the alpha band in the RGBA to RGB parameter.

I hope this helps.

Great @debbiatsafe 


klingdom
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • February 22, 2024

debbiatsafe,

 

I tried your instruction and many gyrations, but still getting Errors @ReinterpretRaster: Failed to obtain raster from feature.  Only features with raster geometry are expected.

Is there a GEOMETRY_TYPE that needs to be expose?

I’m pretty sure these are PDF exports from A-CAD.  I attached a zip of the log and PDF

Thx

Brian


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • February 22, 2024

Hi @klingdom 

Based on the error in the log, you are attempting to send vector features into the RasterInterpretationCoercer transformer. Rasterized pages are output from the pdf_rasterized_pages feature type while vector features are output from the pdf_no_layer feature type.

Re-add a PDF reader that has the Read Rasterized Page parameter enabled (in Non-Spatial section) and connect pdf_rasterized_pages feature type to the RasterInterpretationCoercer.

The PDF file you sent has a rotation applied so you may need to rotate the raster before writing to JPEG. Alternatively, you can also generate a world file in the JPEG writer to auto-apply the rotation. The output JPEG file will then appear in the expected page orientation.


klingdom
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • February 22, 2024

debbiatsafe,

 

Thx very much for all your help!  I have now got the transformation to run without errors.  How can I flip the background and foreground  to black lines on white?

Is there any reading and training on this?

Thx

Brian

 

 


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • February 22, 2024

Hi @klingdom,

Change the RasterInterpretationCoercer’s RGBA to RGB parameter from the default “Drop alpha band” value to “Apply alpha band” for a white background.


klingdom
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • February 28, 2024

Hey debbiatsafe,

That worked!

Darn!  I thought I had tried that just to see what would happen.  

Many Thanks for your help!

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings