Workaround for ImageIO.read bug in OpenJDK 8? - image

I'm using Java 8 (OpenJDK 8, specifically) for a project and I need to read an image from a JPG file. Searching around got me to some similar questions at first (e.g. Read byte array into buffered image WITHOUT ImageIO and Is there a 100% Java alternative to ImageIO for reading JPEG files?), but my problem is different and the solutions there do not meet my requirements.
It turns out that the JPEGImageReader class is still missing. (See openjdk-8: Missing JPEGImageReader functions in libjavajpeg.so) Although that bug report is for Debian, I'm using Kubuntu 14.10 and it's also affected.
Based on the report's last message, no one seems to be working on this issue at this time...
The code snippet to reproduce this error is:
// ...
BufferedImage img = null;
try {
img = ImageIO.read(new File(filename));
} catch (IOException e) {
throw new RuntimeException(e);
}
// ...
The path to the file is valid and this works normally if I use Java 1.7, but changing to 1.8 causes the following excpetion on ImageIO.read call:
Caught UnsatisfiedLinkError: com.sun.imageio.plugins.jpeg.JPEGImageReader.initReaderIDs(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)
I'd like help working around this problem while avoiding:
additional dependencies on other/external libraries;
going back to Java 1.7;
having to rebuild from source;
Oracle's proprietary implementation of the JDK
Working code snippets appreciated.
EDIT-1: Added point #4 to the list.
EDIT-2: Reworded a portion of the main section and added another reference.

I believe this has now been fixed as of March 17th, 2015 release, as per Matthias Klose's email:
Source: openjdk-8 Source-Version: 8u40-b27-1
We believe that the bug you reported is fixed in the latest version of
openjdk-8, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 760926#bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software pp. Matthias Klose
(supplier of updated openjdk-8 package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster#ftp-master.debian.org)

Is using the Oracle JDK a possibility?
If so, there is some info here on a ppa you can use with ubuntu.

You could install the java advanced imaging libraries which also provides a jpeg (and other codec) implementation.

I believe the problem here is with the fact that the generated image is in JPEG format.Once i got it generated it in PNG format,the issue got resolved. I used Grabzit API to capture screenshot and get it saved in PNG format

Related

Tile server for mapbox

I've tried to get this running with versions 2.14.4 and 2.15.2 without success I can run on version 2.13. I'm trying to figure out the issue, step one is as below;
In both versions this is what I see after installing the vectortile extension and restarting but this differs from the screengrab shown in the documentation. So my question is whether the documentation image is out of date or my install has not worked (2.14.4 with Vectortile extension 2.14.4).
I resolved the bug which means I can confirm that the above screenshot does mean that the vectortiles extension has installed properly

Where to download the FPGA bitfile of NI cRIO-9068

I got an error when I am running the Labview, please see the attached picture.
It seems the bitfile is not matching with the system version, since I just updated the software, maybe I should download a new bitfile?
Where can I download one?
This means that the LabVIEW-Software you are trying to use is dynamically loading a bitfile to the FPGA. Whoever compiled the bitfile was using a different version of NI-RIO so you will need to recompile the bitfile from source / ask the original author to send you an updated version, or downgrade your installation of NI-RIO.

com.lowagie.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized

a maven project ,when i want to ctreate a pdf ,happened this:com.lowagie.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized.
Please take a look at the following fragment of the free ebook The ABC of PDF with iText:
As you can see, I create a font 'STSong-Light' with 'UniGB-UCS2-H' as encoding, and I use it to write the Chinese title of the movie "House of The Flying Daggers". You can see that this works perfectly by looking at the screen shot of the PDF.
If it doesn't work for you, then this is what may have gone wrong:
You didn't read the documentation (or you wanted to wait until somebody copy/pasted a snapshot of the documentation) which explains why you didn't include the itext-asian.jar into your CLASSPATH. This jar can be found in the extrajars-2.3.zip
Or you did read the documentation, but you didn't include the correct itext-asian.jar into your CLASSPATH. I see that you are using my name in your code (I am the Lowagie from com.lowagie.text). This means that you are using a version of iText that has been removed from all official servers years ago. That version should no longer be used!
In short: you can solve your problem by upgrading to the latest iText version and making sure that you include the itext-asian.jar.
iTextSharp.text.io.StreamUtil.AddToResourceSearch(
System.Reflection.Assembly.Load("iTextAsian")
)

KineticJS-saveImagedata() , Problems updating to new kineticjs library

I used kinetic-v3.10.4.js for almost all my work.
Now the requirement changed and I need to add few more functionality that are available in newer versions.
So I started using kinetic-v4.0.1.js.
I made a sample file and it is working fine but few functions like saveImageData();,DetectionType.etc. are not working in 4.0.1 as they have been updated and instead of saveImageData(), createBufferImage() is the new function.
I am redoing everything with kinetic v4.0.1 now.
I can't find the old example in the website that was using createBufferImage() for image event detection as it has been updated to 4.3.3
So anyone having any old example that help in pixel detection/image detection with 4.0.1
How about searching from archived internet contents, archive.org
http://web.archive.org/web/*/http://html5canvastutorials.com

Where can I get the latest Microsoft.Exchange.WebServices.DLL?

I'm trying to use the latest Exchange Web Services DLL, however when I search my hard drive I see many versions of Microsoft.Exchange.WebServices.DLL, the most recent being version 14.0.650.7 with a date of 1/24/12.
I want to rebuild my machine but can't find an official place to get this DLL. I attempted to download the latest SDK I don't see any DLL to use, nor is there any CHM for me to use.
Where can I get the latest version of Microsoft.Exchange.WebServices.DLL?
Current version of the EWS Managed API is 1.2. It seems that Microsoft sometimes forgets to update links to the newest download which makes it hard to find out what the newest version is but I usually go to www.microsoft.com/downloads and search for "Exchange Web Services Managed API" whenever I need a fresh download.
UPDATE:
EWS is on NuGet:
http://www.nuget.org/packages?q=EWS
This is an old question, and the two answers by the OP and #JakobChristensen do answer the question. I'll just mention that I'm finding the situation fairly confusing.
I recently (manually, not via NuGet) downloaded the current NuGet version, which they currently call "2.2.0".
https://www.nuget.org/packages/Microsoft.Exchange.WebServices/
But the internal file/product version on the .dll is 15.00.0913.015.
According to this page
https://msdn.microsoft.com/en-us/library/office/dn528373(v=exchg.150).aspx
the file should be placed here:
C:\Program Files\Microsoft\Exchange\Web Services\2.0\
So that's where I placed it. Later, when playing around with a Microsoft sample program I noted that it did indeed reference the file at that location.
But another Microsoft sample program referenced the file in the GAC!
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Exchange.WebServices\15.0.0.0__31bf3856ad364e35\Microsoft.Exchange.WebServices.dll
This version had file/product version 15.00.0847.030.
I'm not sure how that file got there, probably part of a Visual Studio installation.
There's also something called EWSCore, which is apparently a forked version of the official EWS with some bug fixes.
https://www.nuget.org/packages/EWSCore/
My current decision is that I'll consider the official NuGet version to be the version I'll standardize on, and manually download it to my development PC and my build PC and place it here:
C:\Program Files\Microsoft\Exchange\Web Services\2.0\
Options
If you use .net framework, there is a nuget package "Microsoft.Exchange.WebServices 2.2.0" here https://www.nuget.org/packages/Microsoft.Exchange.WebServices
If you use .netstandard/.net5+, you need to go the Github open source project "OfficeDev /
ews-managed-api" here https://github.com/OfficeDev/ews-managed-api , and there you download the code, and compile it. However, this project is targeting .net3.5. So, you need to convert/upgrade it to .netstandard/.net5+ manually and compile it for your self.
!! Update !!: I took the version as of date of this post from GitHub. Replaced Old Style project with SDK project. Target framework set to netstandard2.0. Added packages System.DirectoryServicesandSystem.Security.Cryptography.Xml. In files, I had to remove few namespaces that not compatible, but were not used. Removed AsImageinPhoto, this is public image retrieving method, not needed - it only converts byte array. And fixed loading issue with Assembly.GetExecutingAssembly().GetTypes();`
Type[] types;
try
{
types = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
types = ex.Types.Where(t => t != null).ToArray();
}
I also deleted or excluded from project bunch of files related to documentation, fxcop, and assembly info.
And then it worked for sending emails with different API versions. Reading emails is not tested yet.
There is a third option. Nuget has a package "Microsoft.Exchange.WebServices.NETStandard 2.0.0-beta3" But this is not an official Microsoft code. https://www.nuget.org/packages/Microsoft.Exchange.WebServices.NETStandard/2.0.0-beta3
!! Update !!: Got this version and compared to the original code in option #2. This code has more changes than necessary to convert to .netstandard. It has some async stuff added.

Resources