0

I'm creating an automated system that uses PDF files to drive Blender projects and turn them into 3D visuals.

Problem is, Corel Draw generated PDFs that have a varying offset around 4 pixels in the y and 1 pixels in the x axis.

How can I detect this offset and correct that in a bash script?

I'm using ImageMagic to convert PDFs to PNGs (so Blender can read them)

unfa
  • 1,745

1 Answers1

0

Use align_image_stack program form hugin_tools package. it's normally used to align photos for HDR image reation, but it does great job for what you need.

You can correct the X/Y offset with this command then:

align_image_stack -v -i -a prefix reference.png offset.png

Options used:

-v - verbose mode

-i - correct only X/Y offset (in relation to the first specified input image).

-a - save stabilized files to TIFFs in format prefix####.tif, where ##### is a number of the image staring form 0.

reference.png is the file you want to be the alignment source, the offset.png is the file you want to correct. The first file won't be affected, the second (and all the rest) will be matched to the first.

Then, you just need to convert the prefix0001.tif file to whatever you need, and you're done!

unfa
  • 1,745