How to resize the TIFF image in JAI

public static final void appendImage(String fileName, Document doc, PdfWriter writer)
throws Exception {
try {
/* using the Java Advanced Imaging API to deal with tiffs */
if ( ImageUtil.isTif(fileName) ) {
LOG.debug("We are dealing with a tiff ...");
File file = new File(fileName);
SeekableStream s = new FileSeekableStream(file);
ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, null);
System.out.println("Number of images in this TIFF: " + dec.getNumPages());
PdfContentByte cb = writer.getDirectContent();
for (int k = 0; k < dec.getNumPages(); ++k) {
RenderedImage ri = dec.decodeAsRenderedImage(k);
Raster ra = ri.getData();
BufferedImage bi = new BufferedImage(ri.getColorModel(),Raster.createWritableRaster(ri.getSampleModel(), ra.getDataBuffer(), null), false, new Hashtable());
          LOG.debug("The Buffered Image is :" + bi);
Image img = Image.getInstance(bi, null, true);
          //Sreenivas added for Oregon
          img.rawData();
          LOG.debug("The RawData is:");
          img.scaledHeight();
          LOG.debug("The rheight:");
          img.scaledWidth();
LOG.debug("The rwidth is:");
          //Sreenivas Ended
img.scalePercent(36);
          LOG.debug("The Scale Percent is:" + img);
          float y = doc.top() - img.scaledHeight();
          //float x = doc.top() - img.scaledWidth();//Sreenivas added for Oregon
img.setAbsolutePosition(0, y);
LOG.debug("Top Position..."+ y );
doc.newPage();
cb.addImage(img);
/* the Toolkit can handle GIF, JPEG or PNG. */
else {
java.awt.Image coreImage = Toolkit.getDefaultToolkit().createImage(fileName);
Image image = Image.getInstance(coreImage, null);
image.setAbsolutePosition(0, 0);
doc.newPage();
doc.add(image);
LOG.debug("Added image "+fileName);
catch (Throwable t) {
LOG.error(t);
doc.add(new Chunk(t.getMessage()));
I have written like this.. Image has been display,but it cutting

public static final void appendImage(String fileName,
Document doc, PdfWriter writer)
throws Exception {
try {
/* using the Java Advanced Imaging API to deal
o deal with tiffs */
if ( ImageUtil.isTif(fileName) ) {
LOG.debug("We are dealing with a tiff ...");
File file = new File(fileName);
SeekableStream s = new
s = new FileSeekableStream(file);
ImageDecoder dec =
er dec = ImageCodec.createImageDecoder("tiff", s,
null);
System.out.println("Number of images in this
in this TIFF: " + dec.getNumPages());
PdfContentByte cb =
yte cb = writer.getDirectContent();
for (int k = 0; k < dec.getNumPages(); ++k)
(); ++k) {
RenderedImage ri =
Image ri = dec.decodeAsRenderedImage(k);
Raster ra = ri.getData();
BufferedImage bi = new
e bi = new
BufferedImage(ri.getColorModel(),Raster.createWritable
Raster(ri.getSampleModel(), ra.getDataBuffer(),
null), false, new Hashtable());
          LOG.debug("The Buffered Image is :" + bi);
Image img = Image.getInstance(bi, null,
(bi, null, true);
          //Sreenivas added for Oregon
          img.rawData();
          LOG.debug("The RawData is:");
          img.scaledHeight();
          LOG.debug("The rheight:");
          img.scaledWidth();
LOG.debug("The rwidth is:");
          //Sreenivas Ended
img.scalePercent(36);
          LOG.debug("The Scale Percent is:" + img);
          float y = doc.top() - img.scaledHeight();
//float x = doc.top() -
() - img.scaledWidth();//Sreenivas added for Oregon
img.setAbsolutePosition(0, y);
LOG.debug("Top Position..."+ y );
doc.newPage();
cb.addImage(img);
/* the Toolkit can handle GIF, JPEG or PNG. */
else {
java.awt.Image coreImage =
eImage =
Toolkit.getDefaultToolkit().createImage(fileName);
Image image = Image.getInstance(coreImage,
reImage, null);
image.setAbsolutePosition(0, 0);
doc.newPage();
doc.add(image);
LOG.debug("Added image "+fileName);
catch (Throwable t) {
LOG.error(t);
doc.add(new Chunk(t.getMessage()));
I have written like this.. Image has been
display,but it cutting,pls some body help me..i will be very happy..Thank u lot

Similar Messages

  • How I resized the Small Image for a Product Module

    I wanted a big picture for my small product module.
    1. I inserted {tag_largeimage} in place of {tag_smallimage} on the small product module.
    Site Manager -> Module Templates -> Online Shop -> Individual Product Small.
    The picture was 200 X 275. It was getting cut off.
    2. I open File Manager -> CSS and look in style.css for numbers smaller than those dimensions.
    At the bottom, at lines 1594/1595 I found what I was looking for: "#content .shop-product-small .image".
    3. I increased the dimensions to 200*275. If your site is automatically generating a border you'll need to include them in the final dimensions.
    The customer gets a better view of what I'm selling. I'm happy with the result. I hope this helps.

    Hi Steve,
    You should just use the large product image, use _path to get the raw URL of the image and use the tumbnail generation code (see knowledgebase) and specify your dimensions. This allows you to use then properly use a large product image in your detail view

  • How to add a text Component ( text annotation) to the Tiff Image

    Hi.............
    This is the first time I am using Sun Developers Forum.......................
    My problem is.............I want to add a component ( Text or Label ) to the Tiff Image which is displayed on the JIMICanavs [ from JIMI API ].
    Even , if anybody knows about How to add a component to the JIMICanavs , Please help me..................................

    I'm curious: is JIMI still popular? What advantange does it have over the current Java 2D support in the J2SE, or over JAI?

  • Guys, i want to ask on how to resize the images into 1200 pixels wide?

    Guys, i want to ask on how to resize the images into 1200 pixels wide, how to do it? and what are the step by steps on doing that? thank you!!!

    See this link: http://forums.adobe.com/docs/DOC-3691

  • Filter plugin and resize the output image

    I had write a filter plugin for photoshop.
    But i have a prolem.
    I dont know how i can resize the output image,
    i need clip just last 3 pixel of a only side of an image.
    I had read API but I'have not found what I looking.
    Thank you in advance

    I think it is impossible edit the size of the output image with a filter plugin.....but i'm not sure, so i prefer ask to you developer.
    I think is it possible with an other way.
    An other similar question: is possible put visible the padding pixel in the output image?

  • How to edit 16bit TIFF image sequence file in FCP?

    Dear all,
    I have a number of 16 bit TIFF image sequence files (2048 x 1024 resolution) - some of them are RED footage, and others came directly from our f/x guy. We are going into a color correction session in a post house and we've been asked to provide a sequential 16 bit TIFF image sequence of the edited time line.
    I need to do a cross dissolve b/w most of the clips I have. I have created image sequence QT movie (reference files) from the TIFF images. Though they play fine in QT player, when I try importing into FCP, I am met with a "general error". I tried both dragging it into QT, as well as File --> Import.
    I am wondering what can I do to get these clips into FCP in order to apply the cross dissolve transitions I need. Is this a problem relating to the 16bit nature of the TIFF files?
    I tried exporting the TIFF image sequence standalone QT movie, and those imported fine. However, I have a feeling that the standalone movie conversion also decrease my bit depth from 16 to 8. (When I do my final TIFF output from FCP after dissolves / transitions had been applied, each TIFF file is now 8 MB instead of 12 MB, hence my suspicion that the bit depth is adjusted).
    Are there any settings I am missing, or does FCP simply don't support 16 bit image sequence reference file. As a test, I had also converted all my TIFF to jpg, and created jpeg image sequence reference file. These reference QT file can be successfully imported to FCP and I can edit them as if they are a clip.
    If FCP is not able to handle these files, what are my other options? After Effects?
    Any help is appreciated.
    Thank you.
    Michael
    <Edited by Moderator>

    As far as I know, both FCP and Color only support up to 10 bit color, which is 1024 levels for each color channel, more than enough for avoiding color banding.
    If you need 16 bit for sure, I believe AE will support 16 bit output. Another 16 bit application would be the extended version of Photoshop, which has some limited time line capability.

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • How to put the background image in Title Window?

    Hi,
    I'm newbie in flex. I 'm using Flex 4.
    Can anyone give me some guidelines on how to put the background image in Title Window?
    Is it possible to do this?
    Thanks.

    Hi,
    Check the below sample code
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            s|BorderContainer {
                background-image:Embed(source="image/wheres_the_green_rez.jpg");
                background-image-fill-mode:clip;
        </fx:Style>
        <s:TitleWindow width="100%" height="100%">
            <s:BorderContainer width="100%" height="100%"/>
        </s:TitleWindow>
    </s:Application>
    Regards,
    Anitha

  • Is the tiff image sequence in premiere pro cs4 lossless?

    is the tiff image sequence export in premiere pro cs4 lossless or lossy?

    Hi,
    Yeah, that  IS an interesting question...When I looked into the quality exported individual frames I stuck it into photoshop and looked at the mode and image size to see what I was getting ...
    I was kinda ( am still very ) impressed with the quality of the individual images Premiere exports in it's sequences.. and I suppose you could say it is lossless but in part that would be referenced to , " Lossless compared to what ? "
    If I put TIFF images into the timeline to begin with and then got them out again, then it would probably be lossy depending on ppi going in. It's like 72 coming out.
    But anyway, the quality is pretty darn good, I have to say...when you export TIFs...
    Rod

  • How to clear the clipboard images

    Hai Every body
    Can any one tell me how to clear the clipboard images .
    my application is i used to capture the images from clipboard i had done it but now i want to clear that clipboard images forcebly
    Please if any body knows anything on it please reply me
    if code is availabel i will be very thankfull to you

    Hai Every body
    Can any one tell me how to clear the clipboard images .
    my application is i used to capture the images from clipboard i had done it but now i want to clear that clipboard images forcebly
    Please if any body knows anything on it please reply me
    if code is availabel i will be very thankfull to you

  • How to revert the maintainence image from 2.1(5) to 2.1(3) on NAM2 Module.

    Hi,
    Could some one please help me with the procedure or document on how to revert the maintainence image from 2.1(5) to 2.1(3) on NAM2 Module/
    As I am trying to upgrade the 4.0 software version on the nam.
    Thanks in advance.
    Regards
    Alex.

    I follwed this note only (Deploying Sun JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite 11i [ID 290807.1]) to upgrade my Jre -1.6.0_23 version .Use the same steps to downgrade to 1.6.0_20 (i.e. download the correct plug-in, issue "txkSetPlugin.sh jversion" with the desired version, ..etc).
    I given it to application team for testing they come back with some issues telling that some application and users unable to access so requesting to downgrade the JRE to 1.6.0_20 version.What issues? Have you considered upgrading to 1.6.0_24?
    Mismanaged Session Cookie Issue Fixed for EBS in JRE 1.6.0_23
    http://blogs.oracle.com/stevenChan/2010/12/mismanaged_session_cookie_issue_fixed_ebs.html
    Is it possible to downgrade ? Try the above, or restore from a backup (if you have one) which is taken before upgrading to 1.6.0_23
    Thanks,
    Hussein

  • I was using photoshop CC as normal, when suddenly it started going haywire. It has corrupted all the one PSD files by distorting the images and colour. Does anyone know how to recover the original images?

    I was using photoshop CC as normal, when suddenly it started going haywire. It has corrupted all the open PSD files by distorting the images and colour. They are now completely unrecognisable and unusable. Does anyone know how to recover the original images as I was saving them as I went along but the files are now corrupt?

    What version of Photoshop are you running?
    I've seen a couple of instances over the last week or two where Photoshop has added masks, strange colours and also merged content from two separate PSD files that were open at the same time.
    This has occurred on two different iMacs, (both 10.10.x) running Photoshop CC 2014.2.2 (20141204.r.310 x64).
    see image below for example:

  • How to split multipage TIFF images ?

    Dear Friends,
    I want to split multipage TIFF images using JAI...does anyone know about it...
    Regards,
    V.Prasanna

    Here are a couple of links about multi page tiffs in photoshop or elements.
    http://kb2.adobe.com/cps/325/325224.html
    http://forums.adobe.com/message/3172569
    MTSTUNER

  • How to resize the hard drive

    how to resize the hard drive

    You can usually find your Mac and the instructions to do so by looking it up on this page.
    http://support.apple.com/specs/

  • Software Project - how to change the logo Image

    Hi
    Downloaded and installed sample code - Software Project -
    how to change the logo Image,
    Please do the needfull,

    Hi,
    Go to
    Home>Application Builder>Application 144>Shared Components>Edit Application Definition->Logo
    Logo Type:
    choose Image
    type the path of your image in the text box.
    you have to upload your image inside Shared Components>images
    use
    #APP_IMAGES#YOURIMAGENAME.GIF
    thanks
    Mark Wyatt
    Edited by: Websoft on Oct 8, 2009 12:10 AM

Maybe you are looking for

  • HTTP socket connection

    Hi, I have an applet which communicates with servlets, sending serialized objects back and forth. This works fine but it means communication between client and server can only be instantiated from the client side. It would be better if my applet (or

  • Are previews deleted when photos are deleted?

    After being confused for a while (as I'm sure many are) about not being able to delete photos from my memory card from Lightroom, I am trying to get into a "correct" workflow which I believe involves formatting the card when I have saved and backed u

  • Apple Script/Program start through link on HTML page

    Dear Apple Gurus Probably I'm asking something silly, but I don't know any other way to solve my problem. I have to do some training videos about the finder and system tools. To have it easy, I would like to ad some buttons to the project where you c

  • When using FaceTime the picture is delayed and goes black ever since I updated to iOS6.0.1???

    Since I updated to iOS 6.0.1 when using FaceTime the picture is delayed and goes black???

  • More PDF template woes!

    I am building a PDF template which needs to have 2 lines on the right hand column but only 1 line on the left. I have set the template up as specified in the manual, but it appears to put the left column 1 record out. If I only have 1 line, then all