2

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 ZTimeChannel 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
  • What kind of environment is your application going to work in - web? desktop? What operating system(s) will it run on? There are many programming languages that can manipulate and convert images - PHP is one that springs to mind - but the choice of language depends more on where you want it to work than on what you want it to do. Commented Aug 24, 2009 at 12:28
  • What languages are you proficient in? What kind of image files do you want to convert? Most popular languages should have libraries to handle this. Commented Aug 24, 2009 at 12:29
  • I still don't understand what you want to do. What do you mean by "reorder the sequence in which the pixel intensity data comes"? Commented Aug 24, 2009 at 12:38

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

@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 (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.
3

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

1 Comment

@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?
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.