KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > awt > image > RenderedImage

java.awt.image
Interface RenderedImage

All Known Subinterfaces:
WritableRenderedImage
All Known Implementing Classes:
BufferedImage
See Also:
Top Examples, Source Code

WritableRaster copyData(WritableRaster raster)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[218]Write a text into an image
By Anonymous on 2004/05/12 04:58:38  Rate
//The following code reads an image, writes a string onto the image and  
 //writes it out as a TIFF file. With small modifications ( changing the  
 //encode parms and compression ) , this code will work for JPEGs or any other  
 //image formats. This code used JAI. 
  
  
  
 ParameterBlock pb = new ParameterBlock (  ) ; 
 RenderedImage ri = JAI.create ( "fileload", filename ) ; 
  
  
  
 PlanarImage image= new RenderedImageAdapter ( ri ) ; 
  
  
 BufferedImage bufImg = image.getAsBufferedImage (  ) ; 
 Graphics2D g2d = bufImg.createGraphics (  ) ; 
 g2d.setColor ( Color.black ) ; 
 g2d.drawString ( "annotation", 50, 200 ) ; 
  
  
 PlanarImage planarImage = PlanarImage.wrapRenderedImage ( bufImg ) ; 
 pb.addSource ( planarImage ) ; 
  
  
 TIFFEncodeParam encodeParam = new TIFFEncodeParam (  ) ; 
 encodeParam.setCompression ( TIFFEncodeParam.COMPRESSION_GROUP4 ) ; 
 encodeParam.setExtraImages ( images.iterator (  )  ) ; 
 OutputStream os = new FileOutputStream ( "bi.tiff" ) ; 
  
  
 //pb.addSource ( JAI.create ( "fileload", filename )  ) ; 
 pb.add ( os ) ; 
 pb.add ( "TIFF" ) ; 
 pb.add ( encodeParam ) ; 
 JAI.create ( "encode", pb ) ; 
 os.close (  ) ; 
  
  
 //copyData


ColorModel getColorModel()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Raster getData()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Raster getData(Rectangle rect)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getHeight()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getMinTileX()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getMinTileY()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getMinX()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getMinY()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getNumXTiles()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getNumYTiles()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Object getProperty(String name)
See Also:
Image.UndefinedProperty
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


String[] getPropertyNames()
See Also:
getProperty(String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


SampleModel getSampleModel()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Vector<RenderedImage> getSources()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


Raster getTile(int tileX,
               int tileY)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getTileGridXOffset()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getTileGridYOffset()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getTileHeight()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getTileWidth()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


int getWidth()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags