javax.imageio.stream.ImageInputStream Java Examples

The following examples show how to use javax.imageio.stream.ImageInputStream. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JPEGImageReaderSpi.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public boolean canDecodeInput(Object source) throws IOException {
    if (!(source instanceof ImageInputStream)) {
        return false;
    }
    ImageInputStream iis = (ImageInputStream) source;
    iis.mark();
    // If the first two bytes are a JPEG SOI marker, it's probably
    // a JPEG file.  If they aren't, it definitely isn't a JPEG file.
    int byte1 = iis.read();
    int byte2 = iis.read();
    iis.reset();
    if ((byte1 == 0xFF) && (byte2 == JPEG.SOI)) {
        return true;
    }
    return false;
}
 
Example #2
Source File: InputImageTests.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context)ctx;
    final ImageReader reader = ictx.reader;
    final boolean seekForwardOnly = ictx.seekForwardOnly;
    final boolean ignoreMetadata = ictx.ignoreMetadata;
    do {
        try {
            ImageInputStream iis = ictx.createImageInputStream();
            reader.setInput(iis, seekForwardOnly, ignoreMetadata);
            reader.getImageMetadata(0);
            reader.reset();
            iis.close();
            ictx.closeOriginalStream();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example #3
Source File: TruncatedImageWarningTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {

        String sep = System.getProperty("file.separator");
        String dir = System.getProperty("test.src", ".");
        String filePath = dir+sep+fileName;
        System.out.println("Test file: " + filePath);
        File f = new File(filePath);
        ImageInputStream in = ImageIO.createImageInputStream(f);
        ImageReader reader = ImageIO.getImageReaders(in).next();
        TruncatedImageWarningTest twt = new TruncatedImageWarningTest();
        reader.addIIOReadWarningListener(twt);
        reader.setInput(in);
        reader.read(0);
        if (!twt.receivedWarning) {
            throw new RuntimeException("No expected warning");
        }
    }
 
Example #4
Source File: InputStreamImageInputStreamSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public ImageInputStream createInputStreamInstance(Object input,
                                                  boolean useCache,
                                                  File cacheDir)
    throws IOException {
    if (input instanceof InputStream) {
        InputStream is = (InputStream)input;

        if (useCache) {
            return new FileCacheImageInputStream(is, cacheDir);
        } else {
            return new MemoryCacheImageInputStream(is);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #5
Source File: JFIFMarkerSegment.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void readByteBuffer(ImageInputStream iis,
                    byte [] data,
                    JPEGImageReader reader,
                    float workPortion,
                    float workOffset) throws IOException {
    int progInterval = Math.max((int)(data.length/20/workPortion),
                                1);
    for (int offset = 0;
         offset < data.length;) {
        int len = Math.min(progInterval, data.length-offset);
        iis.read(data, offset, len);
        offset += progInterval;
        float percentDone = ((float) offset* 100)
            / data.length
            * workPortion + workOffset;
        if (percentDone > 100.0F) {
            percentDone = 100.0F;
        }
        reader.thumbnailProgress (percentDone);
    }
}
 
Example #6
Source File: InputImageTests.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context)ctx;
    final ImageReader reader = ictx.reader;
    final boolean seekForwardOnly = ictx.seekForwardOnly;
    final boolean ignoreMetadata = ictx.ignoreMetadata;
    do {
        try {
            ImageInputStream iis = ictx.createImageInputStream();
            reader.setInput(iis, seekForwardOnly, ignoreMetadata);
            reader.read(0);
            reader.reset();
            iis.close();
            ictx.closeOriginalStream();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example #7
Source File: InputStreamImageInputStreamSpi.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ImageInputStream createInputStreamInstance(Object input,
                                                  boolean useCache,
                                                  File cacheDir)
    throws IOException {
    if (input instanceof InputStream) {
        InputStream is = (InputStream)input;

        if (useCache) {
            return new FileCacheImageInputStream(is, cacheDir);
        } else {
            return new MemoryCacheImageInputStream(is);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #8
Source File: JPEGFactory.java    From sambox with Apache License 2.0 6 votes vote down vote up
private static BufferedImage readJpeg(Object fileOrStream) throws IOException
{
    Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("JPEG");
    ImageReader reader = null;
    while (readers.hasNext())
    {
        reader = readers.next();
        if (reader.canReadRaster())
        {
            break;
        }
    }
    requireIOCondition(nonNull(reader), "Cannot find an ImageIO reader for JPEG image");

    try (ImageInputStream iis = ImageIO.createImageInputStream(fileOrStream))
    {
        reader.setInput(iis);
        ImageIO.setUseCache(false);
        return reader.read(0);
    }
    finally
    {
        reader.dispose();
    }
}
 
Example #9
Source File: JFIFMarkerSegment.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
void readByteBuffer(ImageInputStream iis,
                    byte [] data,
                    JPEGImageReader reader,
                    float workPortion,
                    float workOffset) throws IOException {
    int progInterval = Math.max((int)(data.length/20/workPortion),
                                1);
    for (int offset = 0;
         offset < data.length;) {
        int len = Math.min(progInterval, data.length-offset);
        iis.read(data, offset, len);
        offset += progInterval;
        float percentDone = ((float) offset* 100)
            / data.length
            * workPortion + workOffset;
        if (percentDone > 100.0F) {
            percentDone = 100.0F;
        }
        reader.thumbnailProgress (percentDone);
    }
}
 
Example #10
Source File: ImageReaders.java    From JglTF with MIT License 6 votes vote down vote up
/**
 * Tries to find an <code>ImageReader</code> that is capable of reading
 * the given image data. The returned image reader will be initialized
 * by passing an ImageInputStream that is created from the given data
 * to its <code>setInput</code> method. The caller is responsible for 
 * disposing the returned image reader.
 *  
 * @param imageData The image data
 * @return The image reader
 * @throws IOException If no matching image reader can be found
 */
@SuppressWarnings("resource")
public static ImageReader findImageReader(ByteBuffer imageData) 
    throws IOException
{
    InputStream inputStream = 
        Buffers.createByteBufferInputStream(imageData.slice());
    ImageInputStream imageInputStream = 
        ImageIO.createImageInputStream(inputStream);
    Iterator<ImageReader> imageReaders = 
        ImageIO.getImageReaders(imageInputStream);
    if (imageReaders.hasNext())
    {
        ImageReader imageReader = imageReaders.next();
        imageReader.setInput(imageInputStream);
        return imageReader;
    }
    throw new IOException("Could not find ImageReader for image data");
}
 
Example #11
Source File: PNGImageReaderSpi.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public PNGImageReaderSpi() {
    super(vendorName,
          version,
          names,
          suffixes,
          MIMETypes,
          readerClassName,
          new Class[] { ImageInputStream.class },
          writerSpiNames,
          false,
          null, null,
          null, null,
          true,
          PNGMetadata.nativeMetadataFormatName,
          "com.sun.imageio.plugins.png.PNGMetadataFormat",
          null, null
          );
}
 
Example #12
Source File: TruncatedImageWarningTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {

        String sep = System.getProperty("file.separator");
        String dir = System.getProperty("test.src", ".");
        String filePath = dir+sep+fileName;
        System.out.println("Test file: " + filePath);
        File f = new File(filePath);
        ImageInputStream in = ImageIO.createImageInputStream(f);
        ImageReader reader = ImageIO.getImageReaders(in).next();
        TruncatedImageWarningTest twt = new TruncatedImageWarningTest();
        reader.addIIOReadWarningListener(twt);
        reader.setInput(in);
        reader.read(0);
        if (!twt.receivedWarning) {
            throw new RuntimeException("No expected warning");
        }
    }
 
Example #13
Source File: HtmlImage.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
private void readImageIfNeeded() throws IOException {
    downloadImageIfNeeded();
    if (imageData_ == null) {
        if (null == imageWebResponse_) {
            throw new IOException("No image response available (src='" + getSrcAttribute() + "')");
        }
        @SuppressWarnings("resource")
        final ImageInputStream iis = ImageIO.createImageInputStream(imageWebResponse_.getContentAsStream());
        final Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
        if (!iter.hasNext()) {
            iis.close();
            throw new IOException("No image detected in response");
        }
        final ImageReader imageReader = iter.next();
        imageReader.setInput(iis);
        imageData_ = new ImageData(imageReader);

        // dispose all others
        while (iter.hasNext()) {
            iter.next().dispose();
        }
    }
}
 
Example #14
Source File: InputImageTests.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    final Context ictx = (Context)ctx;
    final ImageReader reader = ictx.reader;
    final boolean seekForwardOnly = ictx.seekForwardOnly;
    final boolean ignoreMetadata = ictx.ignoreMetadata;
    do {
        try {
            ImageInputStream iis = ictx.createImageInputStream();
            reader.setInput(iis, seekForwardOnly, ignoreMetadata);
            reader.read(0);
            reader.reset();
            iis.close();
            ictx.closeOriginalStream();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } while (--numReps >= 0);
}
 
Example #15
Source File: JFIFMarkerSegment.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
BufferedImage getThumbnail(ImageInputStream iis,
                           int index,
                           JPEGImageReader reader) throws IOException {
    reader.thumbnailStarted(index);
    BufferedImage ret = null;
    if ((thumb != null) && (index == 0)) {
            ret = thumb.getThumbnail(iis, reader);
    } else {
        if (thumb != null) {
            index--;
        }
        JFIFExtensionMarkerSegment jfxx =
            (JFIFExtensionMarkerSegment) extSegments.get(index);
        ret = jfxx.thumb.getThumbnail(iis, reader);
    }
    reader.thumbnailComplete();
    return ret;
}
 
Example #16
Source File: GIFImageReaderSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public GIFImageReaderSpi() {
    super(vendorName,
          version,
          names,
          suffixes,
          MIMETypes,
          readerClassName,
          new Class[] { ImageInputStream.class },
          writerSpiNames,
          true,
          GIFStreamMetadata.nativeMetadataFormatName,
          "com.sun.imageio.plugins.gif.GIFStreamMetadataFormat",
          null, null,
          true,
          GIFImageMetadata.nativeMetadataFormatName,
          "com.sun.imageio.plugins.gif.GIFImageMetadataFormat",
          null, null
          );
}
 
Example #17
Source File: CanDecodeTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void doTest(ImageReaderSpi spi) throws IOException {
    System.out.println("Test for " + title +
            (canDecode ? " (can decode)" : " (can't decode)"));
    System.out.print("As a stream...");
    ImageInputStream iis =
            ImageIO.createImageInputStream(getDataStream());

    if (spi.canDecodeInput(iis) != canDecode) {
        throw new RuntimeException("Test failed: wrong decideion " +
                "for stream data");
    }
    System.out.println("OK");

    System.out.print("As a file...");
    iis = ImageIO.createImageInputStream(getDataFile());
    if (spi.canDecodeInput(iis) != canDecode) {
        throw new RuntimeException("Test failed: wrong decideion " +
                "for file data");
    }
    System.out.println("OK");
}
 
Example #18
Source File: ImageIO.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@code BufferedImage} as the result of decoding
 * a supplied {@code ImageInputStream} with an
 * {@code ImageReader} chosen automatically from among those
 * currently registered.  If no registered
 * {@code ImageReader} claims to be able to read the stream,
 * {@code null} is returned.
 *
 * <p> Unlike most other methods in this class, this method <em>does</em>
 * close the provided {@code ImageInputStream} after the read
 * operation has completed, unless {@code null} is returned,
 * in which case this method <em>does not</em> close the stream.
 *
 * @param stream an {@code ImageInputStream} to read from.
 *
 * @return a {@code BufferedImage} containing the decoded
 * contents of the input, or {@code null}.
 *
 * @exception IllegalArgumentException if {@code stream} is
 * {@code null}.
 * @exception IOException if an error occurs during reading.
 */
public static BufferedImage read(ImageInputStream stream)
    throws IOException {
    if (stream == null) {
        throw new IllegalArgumentException("stream == null!");
    }

    Iterator<ImageReader> iter = getImageReaders(stream);
    if (!iter.hasNext()) {
        return null;
    }

    ImageReader reader = iter.next();
    ImageReadParam param = reader.getDefaultReadParam();
    reader.setInput(stream, true, true);
    BufferedImage bi;
    try {
        bi = reader.read(0, param);
    } finally {
        reader.dispose();
        stream.close();
    }
    return bi;
}
 
Example #19
Source File: WBMPImageReaderSpi.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public WBMPImageReaderSpi() {
    super("Oracle Corporation",
          "1.0",
          formatNames,
          entensions,
          mimeType,
          "com.sun.imageio.plugins.wbmp.WBMPImageReader",
          new Class[] { ImageInputStream.class },
          writerSpiNames,
          true,
          null, null, null, null,
          true,
          WBMPMetadata.nativeMetadataFormatName,
          "com.sun.imageio.plugins.wbmp.WBMPMetadataFormat",
          null, null);
}
 
Example #20
Source File: ImageUtil.java    From density-converter with Apache License 2.0 6 votes vote down vote up
public static LoadedImage loadImage(File input) throws Exception {
    if (input == null) {
        throw new IllegalArgumentException("input == null!");
    }
    if (!input.canRead()) {
        throw new IIOException("Can't read input file!");
    }

    ImageInputStream stream = ImageIO.createImageInputStream(input);
    if (stream == null) {
        throw new IIOException("Can't create an ImageInputStream!");
    }
    LoadedImage image = read(stream, Arguments.getImageType(input));
    if (image.getImage() == null) {
        stream.close();
    }
    return new LoadedImage(input, image.getImage(), image.getMetadata(), readExif(input));
}
 
Example #21
Source File: JPEGImageReaderSpi.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean canDecodeInput(Object source) throws IOException {
    if (!(source instanceof ImageInputStream)) {
        return false;
    }
    ImageInputStream iis = (ImageInputStream) source;
    iis.mark();
    // If the first two bytes are a JPEG SOI marker, it's probably
    // a JPEG file.  If they aren't, it definitely isn't a JPEG file.
    int byte1 = iis.read();
    int byte2 = iis.read();
    iis.reset();
    if ((byte1 == 0xFF) && (byte2 == JPEG.SOI)) {
        return true;
    }
    return false;
}
 
Example #22
Source File: PNGImageReaderSpi.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean canDecodeInput(Object input) throws IOException {
    if (!(input instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)input;
    byte[] b = new byte[8];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return (b[0] == (byte)137 &&
            b[1] == (byte)80 &&
            b[2] == (byte)78 &&
            b[3] == (byte)71 &&
            b[4] == (byte)13 &&
            b[5] == (byte)10 &&
            b[6] == (byte)26 &&
            b[7] == (byte)10);
}
 
Example #23
Source File: PngOutputTypeTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static ImageInputStream createTestImage(int type) throws IOException  {
    int w = 100;
    int h = 100;

    BufferedImage img = new BufferedImage(w, h, type);

    int dx = w / colors.length;

    for (int i = 0; i < colors.length; i++) {
        for (int x = i *dx; (x < (i + 1) * dx) && (x < w) ; x++) {
            for (int y = 0; y < h; y++) {
                img.setRGB(x, y, colors[i].getRGB());
            }
        }
    }

    File pwd = new File(".");
    File out = File.createTempFile("rgba_", ".png", pwd);
    System.out.println("Create file: " + out.getAbsolutePath());
    ImageIO.write(img, "PNG", out);
    return ImageIO.createImageInputStream(out);
}
 
Example #24
Source File: JFIFMarkerSegment.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
BufferedImage getThumbnail(ImageInputStream iis,
                           JPEGImageReader reader)
    throws IOException {
    iis.mark();
    iis.seek(streamPos);
    DataBufferByte buffer = new DataBufferByte(getLength());
    readByteBuffer(iis,
                   buffer.getData(),
                   reader,
                   1.0F,
                   0.0F);
    iis.reset();

    WritableRaster raster =
        Raster.createInterleavedRaster(buffer,
                                       thumbWidth,
                                       thumbHeight,
                                       thumbWidth*3,
                                       3,
                                       new int [] {0, 1, 2},
                                       null);
    ColorModel cm = new ComponentColorModel(JPEG.JCS.sRGB,
                                            false,
                                            false,
                                            ColorModel.OPAQUE,
                                            DataBuffer.TYPE_BYTE);
    return new BufferedImage(cm,
                             raster,
                             false,
                             null);
}
 
Example #25
Source File: JFIFMarkerSegment.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
BufferedImage getThumbnail(ImageInputStream iis,
                           JPEGImageReader reader)
    throws IOException {
    iis.mark();
    iis.seek(streamPos);
    JPEGImageReader thumbReader = new JPEGImageReader(null);
    thumbReader.setInput(iis);
    thumbReader.addIIOReadProgressListener
        (new ThumbnailReadListener(reader));
    BufferedImage ret = thumbReader.read(0, null);
    thumbReader.dispose();
    iis.reset();
    return ret;
}
 
Example #26
Source File: JFIFMarkerSegment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
BufferedImage getThumbnail(ImageInputStream iis,
                           JPEGImageReader reader)
    throws IOException {
    iis.mark();
    iis.seek(streamPos);
    // read the palette
    byte [] palette = new byte [PALETTE_SIZE];
    float palettePart = ((float) PALETTE_SIZE) / getLength();
    readByteBuffer(iis,
                   palette,
                   reader,
                   palettePart,
                   0.0F);
    DataBufferByte buffer = new DataBufferByte(thumbWidth*thumbHeight);
    readByteBuffer(iis,
                   buffer.getData(),
                   reader,
                   1.0F-palettePart,
                   palettePart);
    iis.read();
    iis.reset();

    IndexColorModel cm = new IndexColorModel(8,
                                             256,
                                             palette,
                                             0,
                                             false);
    SampleModel sm = cm.createCompatibleSampleModel(thumbWidth,
                                                    thumbHeight);
    WritableRaster raster =
        Raster.createWritableRaster(sm, buffer, null);
    return new BufferedImage(cm,
                             raster,
                             false,
                             null);
}
 
Example #27
Source File: GIFImageReaderSpi.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean canDecodeInput(Object input) throws IOException {
    if (!(input instanceof ImageInputStream)) {
        return false;
    }

    ImageInputStream stream = (ImageInputStream)input;
    byte[] b = new byte[6];
    stream.mark();
    stream.readFully(b);
    stream.reset();

    return b[0] == 'G' && b[1] == 'I' && b[2] == 'F' && b[3] == '8' &&
        (b[4] == '7' || b[4] == '9') && b[5] == 'a';
}
 
Example #28
Source File: RAFImageInputStreamSpi.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public ImageInputStream createInputStreamInstance(Object input,
                                                  boolean useCache,
                                                  File cacheDir) {
    if (input instanceof RandomAccessFile) {
        try {
            return new FileImageInputStream((RandomAccessFile)input);
        } catch (Exception e) {
            return null;
        }
    } else {
        throw new IllegalArgumentException
            ("input not a RandomAccessFile!");
    }
}
 
Example #29
Source File: ImageUtils.java    From gravitee-management-rest-api with Apache License 2.0 5 votes vote down vote up
private static Image rescale(Image image, int width, int height) throws InvalidImageException {
    try {
        ImageInputStream imageInputStream = ImageIO.createImageInputStream(image.getData());
        Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);

        while (imageReaders.hasNext()) {
            ImageReader reader = imageReaders.next();
            String discoveredType = reader.getFormatName();

            if (! ALLOWED_MIMETYPE.contains(discoveredType)) {
                throw new InvalidImageException(discoveredType + " format is not supported");
            }

            reader.setInput(imageInputStream);
            reader.getNumImages(true);
            BufferedImage bufferedImage = reader.read(0);
            java.awt.Image scaledImage = bufferedImage.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);
            BufferedImage bufferedScaledImage = new BufferedImage(width, height, bufferedImage.getType());

            Graphics2D g2 = bufferedScaledImage.createGraphics();
            g2.drawImage(scaledImage, 0, 0, null);
            g2.dispose();

            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ImageIO.write(bufferedScaledImage, discoveredType, bos);

            return new Image(image.getType(), image.getMimeType(), bos.toByteArray());
        }

        throw new InvalidImageException("Image can not be rescaled");
    } catch (IOException ioe) {
        throw new InvalidImageException("Image can not be rescaled", ioe);
    }
}
 
Example #30
Source File: ReadAsGrayTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void doTest(int type) throws IOException {
    BufferedImage src = createTestImage(type);

    File f = new File("test.jpg");

    if (!ImageIO.write(src, "jpg", f)) {
        throw new RuntimeException("Failed to write test image.");
    }

    ImageInputStream iis = ImageIO.createImageInputStream(f);
    ImageReader reader = ImageIO.getImageReaders(iis).next();
    reader.setInput(iis);

    Iterator<ImageTypeSpecifier> types = reader.getImageTypes(0);
    ImageTypeSpecifier srgb = null;
    ImageTypeSpecifier gray = null;
    // look for gray and srgb types
    while ((srgb == null || gray == null) && types.hasNext()) {
        ImageTypeSpecifier t = types.next();
        if (t.getColorModel().getColorSpace().getType() == TYPE_GRAY) {
            gray = t;
        }
        if (t.getColorModel().getColorSpace() == sRGB) {
            srgb = t;
        }
    }
    if (gray == null) {
        throw new RuntimeException("No gray type available.");
    }
    if (srgb == null) {
        throw new RuntimeException("No srgb type available.");
    }

    System.out.println("Read as GRAY...");
    testType(reader, gray, src);

    System.out.println("Read as sRGB...");
    testType(reader, srgb, src);
}