• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Class ImageIO - Trouble in Java SE 7 .

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I am having a bit of a problem with the ImageIO-class .

background:
Local:
The examples ( jpg and png ) are running fine on my local-machine :

OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.15.10.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)



Test:
The example ( png ) is not running fine on my test-machine

OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)



I am doing the following :

final String FORMAT_NAME = "PNG";


Works on both Local and Test
final String FORMAT_NAME = "PNG";
this is my working example, works on both local and test.
And my images ( Tested with jpg and png ) comes back as a png.

Works only on the Local-Machine
final String FORMAT_NAME = "JPG"; // FORMAT_NAME="JPEG"
On the Local-Machine
The JPG-files are returned as JPG-files and the PNG-files are returned as JPG-files

On the Test-Machine
I get an imageio-iioexception for the PNG-Files - those files cannot be transformed to JPG-files.

regards, i
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly does it mean that it does not work? What exact error message do you get? Error messages often contain important information about what might be wrong, so it's important to carefully read and understand the error message. If you post the exact error message here, we can help you understand what it might mean.
 
Ingi Erlings
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

As you can see in my post this works on my local-machine ( java version "1.7.0_91" ) but not on my test-machine ( java version "1.7.0_79" ).
So I am guessing that there could be a flaw in the 1.7.0_79-version.
The Error-message does not say to much.

javax.imageio.IIOException: Invalid argument to native writeImage


I have tested both JPG and JPEG.

Reading the following https://docs.oracle.com/javase/tutorial/2d/images/saveimage.html
says

But the following standard image format plugins : JPEG, PNG, GIF, BMP and WBMP are always be present.



-i
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm....

Do your local machine and the test machine run the same operating system? Is is possible to update the test machine to version 1.7.0 update 91? You could then check if it would work on the test machine with update 91.

Or can you install the exact same Java version (update 79) on your local machine? Then you could see if the error also occurs on your local machine.

If, on the same machine, with everything else being the same, the error happens with update 79 and not with update 91 then this is probably a bug in the older Java version.
 
Ingi Erlings
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Jesper for the encouragement.
The easiest step perhaps would be to install update 79 on my own machine.
There is a difference in the operating systems.
On the local machine I was Using Ubuntu 14.04 - now I am using 15.10 (Ubuntu Wily) - and on the test machine I am running Ubuntu 12.04 ( Ubuntu precise ).

I could always live with the solution that I transform the images to PNG, but I do not know how my future requirements will look like.
So I would be in trouble then.

regards, i
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic