Package org.apache.sanselan

Examples of org.apache.sanselan.ImageReadException


        if (bhi.bitsPerPixel == 8)
            return 1;
        else if (bhi.bitsPerPixel == 4)
            return 2;
        else
            throw new ImageReadException("BMP RLE: bad BitsPerPixel: "
                    + bhi.bitsPerPixel);
    }
View Full Code Here


            rgbs[0] = getColorTableRGB(sample1);
            rgbs[1] = getColorTableRGB(sample2);
            //            pixels_written = 2;
        }
        else
            throw new ImageReadException("BMP RLE: bad BitsPerPixel: "
                    + bhi.bitsPerPixel);

        return rgbs;
    }
View Full Code Here

            int rgb = getPixelARGB(alpha, red, green, blue);
            return rgb;
        }
        default:
            throw new ImageReadException("PNG: unknown color type: "
                    + colorType);
        }
    }
View Full Code Here

        case 4: // Paeth
            filter = new ScanlineFilterPaeth(BytesPerPixel);
            break;

        default:
            throw new ImageReadException("PNG: unknown filter_type: "
                    + filter_type);

        }

        return filter;
View Full Code Here

    protected byte[] getNextScanline(InputStream is, int length, byte prev[],
            int BytesPerPixel) throws ImageReadException, IOException
    {
        int filterType = is.read();
        if (filterType < 0)
            throw new ImageReadException("PNG: missing filter type");

        byte scanline[] = this.readByteArray("scanline", length, is,
                "PNG: missing image data");

        byte unfiltered[] = unfilterScanline(filterType, scanline, prev,
View Full Code Here

        String longitudeRef = longitudeRefField.getStringValue();
        RationalNumber longitude[] = (RationalNumber[]) longitudeField
                .getValue();

        if (latitude.length != 3 || longitude.length != 3)
            throw new ImageReadException(
                    "Expected three values for latitude and longitude.");

        RationalNumber latitudeDegrees = latitude[0];
        RationalNumber latitudeMinutes = latitude[1];
        RationalNumber latitudeSeconds = latitude[2];
View Full Code Here

    private byte[] assembleSegments(ArrayList v, boolean start_with_zero)
            throws ImageReadException
    {
        if (v.size() < 1)
            throw new ImageReadException("No App2 Segments Found.");

        int markerCount = ((App2Segment) v.get(0)).num_markers;

        // if (permissive && (markerCount == 0))
        // markerCount = v.size();

        if (v.size() != markerCount)
            throw new ImageReadException("App2 Segments Missing.  Found: "
                    + v.size() + ", Expected: " + markerCount + ".");

        Collections.sort(v);

        int offset = start_with_zero ? 0 : 1;

        int total = 0;
        for (int i = 0; i < v.size(); i++)
        {
            App2Segment segment = (App2Segment) v.get(i);

            if ((i + offset) != segment.cur_marker)
            {
                dumpSegments(v);
                throw new ImageReadException(
                        "Incoherent App2 Segment Ordering.  i: " + i
                                + ", segment[" + i + "].cur_marker: "
                                + segment.cur_marker + ".");
            }

            if (markerCount != segment.num_markers)
            {
                dumpSegments(v);
                throw new ImageReadException(
                        "Inconsistent App2 Segment Count info.  markerCount: "
                                + markerCount + ", segment[" + i
                                + "].num_markers: " + segment.num_markers + ".");
            }
View Full Code Here

        // TODO: concatenate if multiple segments, need example.
        if (exifSegments.size() < 1)
            return null;
        if (exifSegments.size() > 1)
            throw new ImageReadException(
                    "Sanselan currently can't parse EXIF metadata split across multiple APP1 segments.  "
                            + "Please send this image to the Sanselan project.");

        GenericSegment segment = (GenericSegment) exifSegments.get(0);
        byte bytes[] = segment.bytes;
View Full Code Here

        new JpegUtils().traverseJFIF(byteSource, visitor);

        if (result.size() < 1)
            return null;
        if (result.size() > 1)
            throw new ImageReadException(
                    "Jpeg file contains more than one XMP segment.");
        return (String) result.get(0);
    }
View Full Code Here

        {
            App13Segment segment = (App13Segment) segments.get(i);

            PhotoshopApp13Data data = segment.parsePhotoshopSegment(params);
            if (data != null && photoshopApp13Data != null)
                throw new ImageReadException(
                        "Jpeg contains more than one Photoshop App13 segment.");

            photoshopApp13Data = data;
        }
View Full Code Here

TOP

Related Classes of org.apache.sanselan.ImageReadException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.