Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgements
- Part I Introduction to Java
- 1 Introduction
- 2 Language basics
- 3 Classes and objects in Java
- 4 More about objects in Java
- 5 Organizing Java files and other practicalities
- 6 Java graphics
- 7 Graphical User Interfaces
- 8 Threads
- 9 Java input/output
- 10 Java utilities
- 11 Image handling and processing
- 12 More techniques and tips
- Part II Java and the network
- Part III Out of the sandbox
- Appendix 1 Language elements
- Appendix 2 Operators
- Appendix 3 Java floating-point
- Index
- References
11 - Image handling and processing
Published online by Cambridge University Press: 08 January 2010
- Frontmatter
- Contents
- Preface
- Acknowledgements
- Part I Introduction to Java
- 1 Introduction
- 2 Language basics
- 3 Classes and objects in Java
- 4 More about objects in Java
- 5 Organizing Java files and other practicalities
- 6 Java graphics
- 7 Graphical User Interfaces
- 8 Threads
- 9 Java input/output
- 10 Java utilities
- 11 Image handling and processing
- 12 More techniques and tips
- Part II Java and the network
- Part III Out of the sandbox
- Appendix 1 Language elements
- Appendix 2 Operators
- Appendix 3 Java floating-point
- Index
- References
Summary
Introduction
In Chapter 6 we presented the basic techniques for loading image files into applets and applications. We used instances of the Image class to hold images and invoked the drawImage() method in the Graphics class to display them. In this chapter we explore further the image handling and processing capabilities of Java.
In the first few sections we look in greater detail at the Image class and introduce its BufferedImage subclass, which offers many useful features. We discuss how to monitor the loading of images, how to scale image displays, how to create images, and how to save images to files.
We then switch to topics related to image processing. We show how to gain access to the pixels of an image, how to modify them, how to make an image from a pixel array, and how to use these techniques to create animations. We then discuss the standard filters provided with Java 2D and also give an example of a custom filter.
We give only a brief overview of the wide range of image tools available with Java. The classes mentioned here, for example, hold many overloaded constructors and methods that provide many options. See the Java 2 API Specifications for thorough descriptions of the classes. Also, see the book by Knudsen [1] and the other resources for in-depth discussions of images in Java [2, 3].
- Type
- Chapter
- Information
- Publisher: Cambridge University PressPrint publication year: 2005