This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, June 10, 2010 11:35:08 PM(UTC)
Groups: Registered
Posts: 10
Hi,
I'm able to successfully convert a jpg file into jp2 format with the following code in C#
byte[] imgData = File.ReadAllBytes("depp.jpg");
MemoryStream ms = new MemoryStream(imgData);
RasterCodecs.Startup();
RasterCodecs objImageCodec = new RasterCodecs();
RasterImage image = objImageCodec.Load(ms);
MemoryStream jp2MS = new MemoryStream();
objImageCodec.Save(image, jp2MS, RasterImageFormat.Jp2, 24);
byte[] jp2Data = jp2MS.ToArray();
RasterCodecs.Shutdown();
the jpg file size is 13k, however, the output of the jp2 file is 70k, why did it bloat up so much? How can I compress this? I'd like the file size to be around half of the jpg version. Is this possible?
#2
Posted
:
Sunday, June 13, 2010 5:42:20 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can try to change the CodecsJpeg2000SaveOptions.CompressionControl Property and choose a different compression controls (such as the TargetSize mode for example) and then set the desired output size using the CodecsJpeg2000SaveOptions.TargetFileSize Property as follows:
objImageCodec.Options.Jpeg2000.Save.CompressionControl = CodecsJpeg2000CompressionControl.TargetSize;
objImageCodec.Options.Jpeg2000.Save.TargetFileSize = 1000;
Please check the .NET help file for more information regarding compression control.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.