views:

180

answers:

3

I'm trying to do some image file work, specifically convert one image file format to another. Does anyone know of any examples/guides for how one might accomplish this? What kinds of programming languages is this generally done with?

Edit: Apparently I know so little about this I don't even know the important info to tell you :)

So I'm only useful with C++, Java, Python, and the web design languages (HTML, CSS, Javascript/JQuery).

Specifically, I have an image file that is 5 dimensional (X, Y, Z, Time, Channel) and arranges the values of pixels in each coordinate of the 5d matrix in 1 chunk according to an algorithm that increments channel 1x, then every X for the same Y, Z, Time, then every X for the next Y but same Z, Time, etc. What I want to do is reorder that raw data for each pixel so that it is in a .tiff format, which is defined by IFDs, where each IFD would correspond to the X,Y data and there would be Z*Time*Channel IFDs.

Essentially, I just want to reorder the binary values found at each pixel in the image. For example, some image types have a number between 0-255 for grayscale defined at each pixel coordinate (X, Y, Z, Time, Channel). In that scenario, I just want to grab the hex-value at the coordinate, and put it in the correct order according to the .tif designation above.

Also, this would run in windows and mac for now. Would it be possible to do it in Python?

+3  A: 

I use the tools from and the bindings to GraphicsMagic or ImageMagick.

@lutz: can either of these be used to convert a custom image file format into another? like, do they provide a way for me to write custom code based on the custom image file conversion?
hatorade
A: 

If all you're doing is changing filetypes, ImageMagick will do you just fine. Python makes it easy to wrap some ImageMagick calls in a simple GUI or and gives you a full programming language with the option to fall back on the Python Imaging Library if you want to do more later.

Imagist
+2  A: 

Since you're working with a custom file format, you could do this with any language that allows byte-level access to your memory structures (which includes pretty much any language out there). Since you're familiar with C++, Java and Python, I would recommend using C++, Java or Python.

MusiGenesis
@musicGenesis: awesome, thanks. can you suggest any guides to this, or the golden google search terms i would need to research this myself? "Python byte level access" didn't have much luck :(
hatorade
@hatorade (hater + gatorade?): I'm a C# man myself, and I know zip about Python, but I'm sure Python can do what you need. Basically you would open your file with IO (whatever it is in Python) and read it into a byte array, then manipulate it however, then save it back to a file. You would need to know both the original file format and the output format (TIFF) that you want to achieve.
MusiGenesis