Examples of ImageMetadata


Examples of com.lightcrafts.image.metadata.ImageMetadata

    // and the output file type extension, and agrees with the given Document
    // and the configurator about the output image size.
    private static void conformExportOptions(
        Document doc, BatchConfig conf, boolean ignoreResize
    ) {
        ImageMetadata meta = doc.getMetadata();
        File file = meta.getFile();
        String name = file.getName();
        File directory = conf.directory;
        File outFile = new File(directory, name);

        // Mutate the default file into a conformant name:
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

    protected static void initOptions( ImageFileExportOptions options,
                                       ImageInfo imageInfo,
                                       Dimension saveSize )
        throws IOException, LightCraftsException
    {
        final ImageMetadata metadata = imageInfo.getMetadata();
        final ImageType t = imageInfo.getImageType();

        options.setExportFile( imageInfo.getFile() );

        try {
            final ICC_Profile profile = t.getICCProfile( imageInfo );
            if ( profile != null ) {
                final String profileName =
                    ColorProfileInfo.getNameOf( profile );
                options.colorProfile.setValue( profileName );
            }
        }
        catch ( LightCraftsException e ) {
            // use ImageExportOptions' default color profile
        }
        catch ( IOException e ) {
            // use ImageExportOptions' default color profile
        }

        options.originalWidth.setValue( metadata.getImageWidth() );
        options.originalHeight.setValue( metadata.getImageHeight() );
        options.resizeWidth.setValue( saveSize.width );
        options.resizeHeight.setValue( saveSize.height );

        final double resolution = metadata.getResolution();
        final int resolutionUnit = metadata.getResolutionUnit();

        if ( resolution > 0 && resolutionUnit != RESOLUTION_UNIT_NONE ) {
            options.resolution.setValue( (int)resolution );
            options.resolutionUnit.setValue( resolutionUnit );
        }

        if ( options instanceof TIFFImageType.ExportOptions ) {
            final TIFFImageType.ExportOptions tiffOptions =
                (TIFFImageType.ExportOptions)options;

            final int bitsPerChannel = metadata.getBitsPerChannel();
            if ( bitsPerChannel > 0 )
                tiffOptions.bitsPerChannel.setValue( bitsPerChannel );
        }
    }
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

    }

    // If the file is a saved document, show the dimensions of the original
    // image.  Otherwise, show the image dimensions of the file itself.
    public String getValue(ImageMetadata meta) {
        ImageMetadata origMeta = getOriginalImageMetadata(meta);
        if (origMeta != null) {
            return getDimensionText(origMeta);
        }
        else {
            return getDimensionText(meta);
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

        tables.clear();

        add(new PaneTitle(LOCALE.get("MetadataTitle")));

        ImageMetadata meta = null;
        try {
            meta = info.getMetadata();
        }
        catch (Throwable t) {
            // BadImageFileException, IOException, UnknownImageTypeException
            t.printStackTrace();
        }
        if (meta == null) {
            String no = LOCALE.get("NoLabel");
            JLabel label = new JLabel(no);
            label.setAlignmentX(.5f);
            add(Box.createVerticalGlue());
            add(label);
            add(Box.createVerticalGlue());
            error = true;
            return;
        }
        Collection<ImageMetadataDirectory> directories =
            meta.getDirectories();
        if (directories.isEmpty()) {
            String empty = LOCALE.get("EmptyLabel");
            JLabel label = new JLabel(empty);
            label.setAlignmentX(.5f);
            add(Box.createVerticalGlue());
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

        }
        return null;
    }

    private static ImageInfo getImageInfo(Document doc) {
        final ImageMetadata meta = doc.getMetadata();
        final File file = meta.getFile();
        return ImageInfo.getInstanceFor(file);
    }
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

        if (dirty) {
            sb.append("* ");
        }
        if (doc != null) {
            File file = doc.getFile();
            ImageMetadata meta = doc.getMetadata();
            if (file == null) {
                file = meta.getFile();
            }
            String name = file.getName();
            String imageName = meta.getFile().getName();
            if (! name.equals(imageName)) {
                name = name + " [" + imageName + "]";
            }
            sb.append(name);
            ScaleModel scaleModel = doc.getScaleModel();
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

        }
    }

    public void run() {
        // First initialize metadata, if it's not already read.
        ImageMetadata meta = datum.getMetadata(true);

        RenderedImage image = null;

        // If there's a file cache entry, use that.
        if (!datum.isBadFile() && cache != null) {
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

    private enum LznEncoding { LZN, JPEG, TIFF_Sidecar, TIFF_Multilayer }

    // Figure out the type of LZN encoding used in the given ImageDatum, or
    // return null if this ImageDatum does not contain any readable LZN data.
    private static LznEncoding getLznEncoding(ImageDatum datum) {
        ImageMetadata meta = datum.getMetadata(true);
        ImageType type = meta.getImageType();
        if (type instanceof LZNImageType) {
            return LznEncoding.LZN;
        }
        if (type instanceof SidecarJPEGImageType) {
            return LznEncoding.JPEG;
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

            left = leftLeader;
        }
        if (rightLeader != null) {
            right = rightLeader;
        }
        ImageMetadata metaLeft = left.getMetadata(true);
        ImageMetadata metaRight = right.getMetadata(true);

        Class<? extends ImageMetadataDirectory> clazz = CoreDirectory.class;
        ImageMetaValue leftValue = metaLeft.getValue(clazz, tagId);
        ImageMetaValue rightValue = metaRight.getValue(clazz, tagId);

        if (leftValue != null && rightValue != null) {
            if (! reverse) {
                int comp = leftValue.compareTo(rightValue);
                if (comp == 0) {
View Full Code Here

Examples of com.lightcrafts.image.metadata.ImageMetadata

            left = leftLeader;
        }
        if (rightLeader != null) {
            right = rightLeader;
        }
        ImageMetadata metaLeft = left.getMetadata(true);
        ImageMetadata metaRight = right.getMetadata(true);

        Class<? extends ImageMetadataDirectory> clazz = CoreDirectory.class;
        ImageMetaValue leftValue = metaLeft.getValue(clazz, CORE_FILE_NAME);
        ImageMetaValue rightValue = metaRight.getValue(clazz, CORE_FILE_NAME);

        if (leftValue != null && rightValue != null) {
            if (! reverse) {
                int comp = leftValue.compareTo(rightValue);
                return comp;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.