Helper class for debugging stuff in Image I/O. : Image IO « 2D Graphics GUI « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » 2D Graphics GUI » Image IOScreenshots 
Helper class for debugging stuff in Image I/O.
 
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 
 *      http://www.apache.org/licenses/LICENSE-2.0
 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* $Id: ImageIODebugUtil.java 610706 2008-01-10 08:14:18Z jeremias $ */


import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataFormatImpl;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Node;

/**
 * Helper class for debugging stuff in Image I/O.
 *
 @version $Id: ImageIODebugUtil.java 610706 2008-01-10 08:14:18Z jeremias $
 */
public class ImageIODebugUtil {

    public static void dumpMetadata(IIOMetadata meta, boolean nativeFormat) {
        String format;
        if (nativeFormat) {
            format = meta.getNativeMetadataFormatName();
        else {
            format = IIOMetadataFormatImpl.standardMetadataFormatName;
        }
        Node node = meta.getAsTree(format);
        dumpNode(node);
    }
    
    public static void dumpNode(Node node) {
        try {
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer t = tf.newTransformer();
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            Source src = new DOMSource(node);
            Result res = new StreamResult(System.out);
            t.transform(src, res);
            System.out.println();
        catch (Exception e) {
            e.printStackTrace();
        }
    }

}

   
  
Related examples in the same category
1. Display image supported by ImageIO
2. Print an Image to print directly
3. List All reader and writer formats supported by ImageIO
4. Display available ImageReaders and ImageWriters by image format and MIME typeDisplay available ImageReaders and ImageWriters by image format and MIME type
5. Write an image of a given format
6. Read an image
7. Simple, functional ImageReaderSpi used to understand how information
8. Simple, functional ImageWriterSpi used to understand how information
9. Example showing how to reset the ordering of ImageReaderSpis in Image I/OExample showing how to reset the ordering of ImageReaderSpis in Image I/O
10. Using mediatracker to pre-load images
11. Get list of unique supported read formats
12. Get list of unique supported write formats
13. Get list of unique MIME types that can be read
14. Get list of unique MIME types that can be written
15. Returns true if the specified format name can be read
16. Returns true if the specified format name can be written
17. Returns true if the specified file extension can be read
18. Returns true if the specified file extension can be written
19. Returns true if the specified mime type can be read
20. Returns true if the specified mime type can be written
21. Show ImageIO Info
22. Write Image with different types
23. Load the image file from a folder or a jar file: use javax.imageio.ImageIO class to read the image file
24. Compress and save an image to the disk
25. Creates a new raster copy
26. Resizes an image
27. Creates an image compatible with the current display
28. Produces a copy of the supplied image
29. Produces a resized image that is of the given dimensions
30. Loads an image in a format compatible with the current display
31. Thumbnail Generator
32. Saves an image to the disk
w___w___w___._j__a__v_a_2___s.___co__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.