Is there a way to find out the requirements that Processing has for loading TIFF files? The documents say only gif, .jpg, .tga, or .png but I can load TIFF if the TIFF has been made by Processing.
Error: Processing can only read its own TIFF files.
So what or where is the difference between a proprietary TIFF and a Processing TIFF? If I know this I can go about translating my files so they will load.
I think a place to start would be to look through the source code to find where the message comes from: it’s a String in PImagehere. It is triggered a few lines later due to this condition:
if ((tiff[42] != tiff[102]) || // width/height in both places
(tiff[43] != tiff[103])) {
System.err.println(TIFF_ERROR);
return null;
}
Looks like the saveTIFF function is not far below. In that function, the array elements compared above are set like this:
How do I load images that are .tiff format? loadImage() only works with ( .gif, .jpg, .tga, .png). I want to use tiff, not something else. Is there a different method, or a workaround? I saw loadImageIO() somewhere but it needs some Java to make that work.
Thanks!
Thanks @Chrisir
That is indeed my plan B. I don’t want to convert if I can avoid it but I am currently investigating whether PNG 24 is same image quality (ignoring meta data, layers, etc.) as TIFF. If it is, I might as well use PNG or JPG images as you suggest.
java.lang.NullPointerException
at processing.core.PApplet.loadImageIO(PApplet.java:5724)
at importIOtest.setup(importIOtest.java:26)
at processing.core.PApplet.handleDraw(PApplet.java:2432)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1547)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:313)
So, now I do not know whether the problem is with the code or the TIFF. I am hoping it is the code because that should be fairly easy to fix.
I have used the full path to the file rather than a relative path. Correct?
When converting…
If you want to preserve quality in conversion use a lossless format that such as PNG, TGA or TIFF.
You can also use GIF but keep in mind this is 8-bit color.
JPG compression is a lossy algorithm and loses quality in compression; it may not be discernible for pictures but the quality (data) is lost.
I am confident that you will discover this in your investigation.
On a side note, I always save my images to TGA if I am saving frames in a Processing sketch for use later with Processing Movie Maker or other tools. TGA is so much faster for this; I have SSDs so writes are fast. PNG has the same quality but is so much slower to process because it has to compress it.
Thanks @behreajj
That is what I was looking for! (I think.)
I am assuming the widths and heights are to do with the TIFF HEADER and not the image. So, I’ll try removing the image preview (embedded thumbnail) first and then I’ll try stripping out the header. Or am I barking up the wrong tree?
/Paul
Thanks @glv I have no knowledge of TGA. Ignoring speed, would I be losing any image quality if I converted from TIFF to TGA? Ceteris paribus, which is better quality PNG or TGA?
There should be no loss converting from TIFF to TGA; I am assuming the software is trusted and you same the same format, color depth, etc. I will leave this part with you.
PNG and TGA should have the same quality; PNG is compressed (lossless) and TGA is not.
Sacre bleu, it works!! I will not now try the other approaches (stripping headers, changing formats, etc.) but would be curious to know if that TIFF HEADER approach might have worked.