Package com.lightcrafts.image.metadata

Examples of com.lightcrafts.image.metadata.ImageMetadata$ProviderComparator


        // If it's somehow a saved document:
        if (interp != null) {
            if (interp.imageFile != null) {
                ImageInfo imageFileInfo =
                    ImageInfo.getInstanceFor(interp.imageFile);
                ImageMetadata meta = imageFileInfo.getMetadata();
                doc = new Document(interp.xml, meta, interp.info, null);
            }
            else {
                // Maybe an LZT.  Trigger the MissingImageFileException.
                doc = new Document(interp.xml);
            }
            DocumentDatabase.addDocumentFile(file);
        }
        else {
            // Maybe it's an image:
            ImageInfo info = ImageInfo.getInstanceFor(file);
            ImageMetadata meta = info.getMetadata();
            ImageType type = info.getImageType();

            // Maybe set up a template with default tools:
            XmlDocument xml = null;
View Full Code Here


    // New Documents created from RAW files get a "RAW Adjustments" singleton
    // tool, if they don't have one already.  These tools can not be part of
    // the default RAW templates, because the tool's initial state depends on
    // the image itself.
    private static void maybeAddRawAdjustments(Document doc) {
        ImageMetadata meta = doc.getMetadata();
        ImageType type = meta.getImageType();
        if (type instanceof RawImageType) {
            if (! doc.hasRawAdjustments()) {
                Engine engine = doc.getEngine();
                OperationType rawType = engine.getRawAdjustmentsOperationType();
                Editor editor = doc.getEditor();
View Full Code Here

        }
    }

    public static boolean export(ComboFrame frame, Document doc) {
        ImageExportOptions oldOptions = doc.getExportOptions();
        ImageMetadata meta = doc.getMetadata();
        final Engine engine = doc.getEngine();
        Dimension size = engine.getNaturalSize();

        ImageExportOptions newOptions;
        if (oldOptions != null) {
View Full Code Here

            XmlDocument xml = new XmlDocument("Template")// See Document()
            XmlNode root = xml.getRoot();
            doc.saveTemplate(root);

            SaveTemplateDialog dialog = new SaveTemplateDialog();
            ImageMetadata meta = doc.getMetadata();
            key = dialog.showDialog(meta, xml, namespace, frame);
            if (key == null) {
                // Dialog was disposed, or the user cancelled.
                return null;
            }
View Full Code Here

    }

    static SaveOptions getSaveOptions(Document doc) {
        SaveOptions options = doc.getSaveOptions();
        if (options == null) {
            ImageMetadata meta = doc.getMetadata();

            Preferences prefs = getPreferences();
            boolean byOriginal = prefs.getBoolean("SaveByOriginal", true);
            File dir;
            if (byOriginal || LastSaveOptions == null) {
                dir = meta.getFile().getParentFile();
            }
            else {
                dir = LastSaveOptions.getFile().getParentFile();
            }
            options = SaveOptions.getDefaultSaveOptions();

            ImageFileExportOptions export =
                (ImageFileExportOptions) SaveOptions.getExportOptions(options);
            ImageType type = export.getImageType();

            File file = new File(dir, meta.getFile().getName());
            String name = ExportNameUtility.getBaseName(file);
            name = name + "_lzn." + type.getExtensions()[0];
            file = new File(name);
            file = ExportNameUtility.ensureNotExists(file);
View Full Code Here

        File file = doc.getFile();
        if (file != null) {
            jobName = file.getName();
        }
        else {
            ImageMetadata meta = doc.getMetadata();
            jobName = meta.getFile().getName();
        }
        printer.setJobName(jobName);

        boolean doPrint = printer.printDialog();
View Full Code Here

    public static void main(String[] args)
        throws BadImageFileException, IOException, UnknownImageTypeException
    {
        File file = new File(args[0]);
        ImageInfo info = ImageInfo.getInstanceFor(file);
        ImageMetadata meta = info.getMetadata();
        URL url = getDefaultDocumentUrl(meta);
        if (url != null) {
            XmlDocument doc = DocumentDatabase.getDefaultDocument(meta);
            doc.write(System.out);
        }
View Full Code Here

    // the resize dimensions, which are set to the document's "natural"
    // dimensions.
    private static SaveOptions createTemplateSaveOptions(
        Document doc, ImageFileExportOptions export, boolean ignoreResize
    ) {
        ImageMetadata meta = doc.getMetadata();
        File file = meta.getFile();
        ImageType type = export.getImageType();
        String ext = type.getExtensions()[0];
        file = ExportNameUtility.setFileExtension(file, ext);
        file = ExportNameUtility.ensureNotExists(file);
        if (type == LZNImageType.INSTANCE) {
View Full Code Here

    // 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

    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

TOP

Related Classes of com.lightcrafts.image.metadata.ImageMetadata$ProviderComparator

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.