Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help

JPEG2000 encoder issues

  •  06 Dec 2007, 8:03 AM

    JPEG2000 encoder issues

    We have a couple of JPEG2000 encoder issues, and I wanted to post a sample application to show these issues, but when I ran the sample application I get the following error: Failed at Jp2SetEncoderOptions on the atalaimage Save method. This is interesting as we don't get this error on development boxes, but it is an error we're getting in QA. The sample code is:

    namespace jp2test
    {
        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    AtalaImage srcImage = new AtalaImage(" 02733_00000.TIF?);
                    Jp2Encoder encoder = new Jp2Encoder(100.0);
                    encoder.FileFormat = Jp2FileFormat.Jp2;
                    encoder.ResolutionParams = new Jp2ResolutionParams();
                    encoder.ResolutionParams.ResolutionType = Jp2ResolutionTypes.Capture;
                    encoder.ResolutionParams.ResolutionHorizontal = (int)srcImage.Resolution.X;
                    encoder.ResolutionParams.ResolutionVertical = (int)srcImage.Resolution.Y;
                    encoder.ResolutionParams.ResolutionUnit = srcImage.Resolution.Units == ResolutionUnit.DotsPerCentimeters ? Jp2ResolutionUnits.DotsPerCentimeter : Jp2ResolutionUnits.DotsPerInch;
                   
                    AtalaImage greyIshImage = srcImage.GetChangedPixelFormat(PixelFormat.Pixel4bppIndexed);
                    greyIshImage.Save("image.jp2", encoder, null);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
    }

    02733_00000.TIF is a 1bpp TIFF.

    Why are we getting this error?

    Thanks

    Richard. (yup QA time again!)

    Filed under: ,
View Complete Thread