private void convert (final DataType fromType, final DataType toType) { Lookup.getDefault().lookup(ImplementationFactoryJAI.class); final EditableImage image = EditableImage.create(new CreateOp(640, 480, fromType)); assertEquals(fromType, image.getDataType()); assertEquals("KODAK Grayscale Conversion - Gamma 1.0", ImageUtils.getICCProfileName(image.getICCProfile())); assertNotNull(image.getICCProfile()); image.execute(new ChangeFormatOp(toType)); assertEquals(toType, image.getDataType()); assertNotNull(image.getICCProfile()); assertEquals("KODAK Grayscale Conversion - Gamma 1.0", ImageUtils.getICCProfileName(image.getICCProfile())); } }
/*************************************************************************** * * **************************************************************************/ private void assertImage (final EditableImage image, final int bandCount, final int bitsPerBand, final int bitsPerPixel, final EditableImage.DataType dataType) { AssertJUnit.assertEquals(WIDTH, image.getWidth()); AssertJUnit.assertEquals(HEIGHT, image.getHeight()); AssertJUnit.assertEquals(bandCount, image.getBandCount()); AssertJUnit.assertEquals(bitsPerBand, image.getBitsPerBand()); AssertJUnit.assertEquals(bitsPerPixel, image.getBitsPerPixel()); AssertJUnit.assertEquals(dataType, image.getDataType()); } }
final int bitsPerBand = image.getBitsPerBand(); final int bitsPerPixel = image.getBitsPerPixel(); final EditableImage.DataType dataType = image.getDataType();
AssertJUnit.assertEquals(8, image.getBitsPerBand()); AssertJUnit.assertEquals(24, image.getBitsPerPixel()); AssertJUnit.assertEquals(EditableImage.DataType.BYTE, image.getDataType()); AssertJUnit.assertEquals(1995, image.getHeight()); AssertJUnit.assertEquals(3000, image.getWidth());