Well I've finally taken the plunge and have started tinkering about with Blender . I decided to try and code in TIFF image support after reading the readme in source/blender/imbuf/ about how you code in new image formats... After a bit of research into the format I decided to use libtiff for all the grunt-work of loading / saving the images.
Anyway, down to the point, in the readme that I mentioned about adding in new image formats, it mentions the following:
Coding in a save function was easy enough, but when writing my tiff loading function I ran into problems. As far as I can tell, when loading in an image, Blender loads the contents of the image file into memory first, then tries to work out what type it is, then calls that particular type's load function (eg img_loadtiff) and gives it a pointer to the memory where the image file was loaded in. This is a problem when trying to code something that uses libtiff, because according to the libtiff documents I've read (both the man page and IBM DeveloperWorks) pretty much all libtiff functions that I'd be using to load the tiff in need a special "TIFF handle", which you get using the following:Step 1:
create a new file named after the format for example lets say we were
creating an openexr read/writer use openexr.c
It should contain functions to match the following prototypes:
struct ImBuf *imb_loadopenexr(unsigned char *mem,int size,int flags);
Code: Select all
TIFF* outputFile = TIFFOpen("output.tif", "w");
Sorry for the long post, thanks for any help you can give me guys!