cureos / csj2k Goto Github PK
View Code? Open in Web Editor NEWPortable Class Library adaptation of JPEG 2000 codec library CSJ2K at http://csj2k.codeplex.com/
License: Other
Portable Class Library adaptation of JPEG 2000 codec library CSJ2K at http://csj2k.codeplex.com/
License: Other
With every image, loaded from byte[] i got this error:
at CSJ2K.j2k.codestream.reader.FileBitstreamReaderAgent..ctor (CSJ2K.j2k.codestream.reader.HeaderDecoder hd, CSJ2K.j2k.io.RandomAccessIO ehs, CSJ2K.j2k.decoder.DecoderSpecs decSpec, CSJ2K.j2k.util.ParameterList pl, System.Boolean cdstrInfo, CSJ2K.j2k.codestream.HeaderInfo hi) [0x00384] in C:\csj2k\CSJ2K\j2k\codestream\reader\FileBitstreamReaderAgent.cs:377
at CSJ2K.j2k.codestream.reader.BitstreamReaderAgent.createInstance (CSJ2K.j2k.io.RandomAccessIO in_Renamed, CSJ2K.j2k.codestream.reader.HeaderDecoder hd, CSJ2K.j2k.util.ParameterList pl, CSJ2K.j2k.decoder.DecoderSpecs decSpec, System.Boolean cdstrInfo, CSJ2K.j2k.codestream.HeaderInfo hi) [0x00012] in C:\csj2k\CSJ2K\j2k\codestream\reader\BitstreamReaderAgent.cs:1087
at CSJ2K.J2kImage.FromStream (System.IO.Stream stream, CSJ2K.j2k.util.ParameterList parameters) [0x000aa] in C:\csj2k\CSJ2K\J2kImage.cs:111
at CSJ2K.J2kImage.FromBytes (System.Byte[] j2kdata, CSJ2K.j2k.util.ParameterList parameters) [0x00007] in C:\csj2k\CSJ2K\J2kImage.cs:55
`
var bmp = J2kImage.FromBytes(Convert.FromBase64String(data)).As<Bitmap>();`
As described in the documentation, encoding of Bitmap/WriteableBitmap is currently not supported.
Can you please provide a sample how to convert a Bitmap/WriteableBitmap to a CSJ2K supported format?
Thank you for help in advance
Using the following code to convert a jpg to a jp2. When I read the jp2 the image appears too light (brightness or gamma appear to be off). Any ideas?
BitmapImageCreator.Register();
using (var bitmap = (Bitmap)Image.FromFile(@"C:\temp\jp2\llb.jpg"))
{
var enc = J2kImage.ToBytes(bitmap);
File.WriteAllBytes(@"C:\temp\jp2\llb.jp2", enc);
}
Hi. Thanks for your previous answer.
Running a few tests, it appeared that csj2k cannot decode argb files.
Do you confirm that fact, or were my files (encoded with XnView) malformed?
Thanks,
Sylvain.
Currently, pixel data using more than 8 bits per pixel component is discarded; int
data is truncated to byte
in the PortableImage
construct. CSJ2K should ensure that these data are sufficiently transferred to output.
After loading a jp2 file, the following error appears:
System.OutOfMemoryException: Array dimensions exceeded supported range.
Loading is done like this: J2kImage.FromFile(sourceFile.FullName)
Version 3.0.0
The file could be uploaded if desired
Just compiled the codectest. While opening file1.jp2 to file10.jp2 works ok, file11.jp2 to file14.jp2 (which were encoded by the codectest) all show constant grayvalues of 128.
Does this work on your system?
Hi,
I'm testing the library in a Xamarin.Forms project. I have a jpg image in my resources, and I want to encode it and get the encoded Stream
.
In order to do that, I created an BlkImgDataSrc
, then I get the byte array of the encodable source. Finally, I convert the byte array in a Stream.
The code:
var encodableSource = J2kImage.CreateEncodableSource(myStream);
var byteArray = J2kImage.ToBytes(encodableSource);
var encodedStream = new MemoryStream(byteArray);
I get an error in the first line: "System.ArgumentOutOfRangeException. Invalid image type Parameter name: streams".
Am I doing something wrong?
Note: I'm using CSJ2K 3.0.0.
Thanks in advance!
I had to use the CSJ2K.NetCore nuget package instead of the CSJ2K nuget package in order to be able to use CSJ2K.Util.BitmapImageCreator.Register();
.
Is this normal that you have to use the .NetCore nuget package to be able to use BitmapImageCreator on .NET Core 3.1? As I was not able to find this in the CSJ2K package.
The first line of this code doesn't build when using the CSJ2K package because BitmapImageCreator is not found:
CSJ2K.Util.BitmapImageCreator.Register();
bmp = CSJ2K.J2kImage.FromBytes(data).As<Bitmap>();
(I'm using Microsoft.WindowsDesktop.App as Framework dependency)
Hi, i´m developing an iOS app with Xamarin using your library.
Servers send me J2C codestream files. When trying to open i get
Invalid number of components: 5.
I have no control how the file is created because the servers aren´t run by me.
The files are created with kakadu library.
Thanks for your help.
Monti
Mac Gimp 2.0 can open the file
This is the file (renamed to .txt should be j2c)
test.txt
The attached sample image cant be decompressed, it does open in irfanview alright it happens with any image which is compressed with 33003 jp2k
file15.zip
The exact error it get is 'Index was outside the bounds of the array. at CSJ2K.j2k.image.ImgDataConverter.getData(DataBlk blk, Int32 c, Boolean intern) '
Hi,
I upgraded WriteableBitmapEx to version 1.5.0 (via NuGet) and whenever I call CSJ2K.J2kImage.FromBytes(), exception occurs stating that WriteableBitmapEx 1.0.6 is not found.
Thanks.
I am not sure this would be useful, but our legal team just reviewed the license of the product, as we were planning to use it in commercial product.
The conclusion was that the license is strange and that products using the code must conform to the ISO/IEC 15444-1 standard - something that is very time-consuming to verify. Too bad that such good project is restricted by a bad license - I guess applied by its original authors 15 years ago.
Hi.
JJ2000 supports quality settings (bit per pixel at least, and maybe more, like target file size) in the encoder.
Do you think it would be possible to add quality/target size settings to CSJ2K.ToBytes(...)?
Thanks,
Sylvain.
Basis for encoder API implementation can be found in this Java source code in the original CSJ2K repository.
Does not work with WriteableBitmapEx.Wpf 1.5.0.0 - it tries to load 1.0.6.0 version
Hi, package available via NuGet does not contain library for WinForms.
I still able to build WinForms dll from sources, but it is less usefull than NuGet package.
Could you please update package to have libraries for all platforms?
I'm currently trying to encode a .ppm file lossless and getting the same file (.ppm) back when decoding. Somehow i always end up with a .png file in the end and have no idea how to change that.
I'm currently doing the encoding and decoding in F#.
This is an example of how the code looks like. I also tried changing the parameters, but the output fileformat didn't change. The picture i got in the last step was always a PNG, while the input was a PPM. I tried different PPM pictures (including the samples from the testfile).
let image = File.OpenRead @"filepath"
let enc = J2kImage.ToBytes(J2kImage.CreateEncodableSource(image2))
File.WriteAllBytes(@"filepath2", enc)
let dec = J2kImage.FromFile(@"filepath2")
let dec2 = dec.As()
dec2.Save(@"filepath3")
Thanks in advance for any help.
I have a jp2 file which opens correctly in FastStone Image viewer (a scanned document) which renders garbled with the library.
On debugging I have found that numTiles [j2kimage.cs line 221] for this file is not 1,1 dimension and is in fact 2,4
How can this be fixed?
Thanks Mehdi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.