Sunday, November 28, 2010

Merge povray's partial images of arbitrary size

Programmer Question

Starting situation:




Using povray I create 4 partial images of a scene.




povray +SR1 +ER200 +SC0 +EC200 +W400 +H400 +OPART1 povray.pov
povray +SR1 +ER200 +SC201 +EC400 +W400 +H400 +OPART11 povray.pov
povray +SR201 +ER400 +SC0 +EC200 +W400 +H400 +OPART2 povray.pov
povray +SR201 +ER400 +SC201 +EC400 +W400 +H400 +OPART22 povray.pov


Problem to solve:




  • Merge the 4 images programmatically.



Things to take in consideration:




  • Most of the partial images are NOT valid images and cannot be opened. For example, the first partial image can be opened, showing a rectangle with the image at the top left and everything else is black. But the rest of the images contain only the information regarding his zone. We could say that those images are broken.

  • The output format is set with the +F and could be PPM, PNG, Uncompressed and Compressed Targa. A valid solution could use any of those formats.

  • Focus on how to merge the images. You know the rectangle that each partial image have.



Things that have been tried:




  • Concatenating the images with Tail as described in http://povray.tashcorp.net/tutorials/qd_multicpu_render/ . It only works if the partial images are complete on the width axis, that is if PART1 is a set of lines, PART2 another set of lines...and no column division. But we have column division.

  • Use ImageMagick. It cannot open the partial images. It says they are broken.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails