Display part of an image in a box

I have a script that places several images in boxes using script labels.  I use the command, "fit myrect3 given content to frame" and that works great for all images but one.  One image is larger than the box and I only want to show a portion of the image.  Currently I move the image manually until I can only see the part of the image I want.  The image is always formatted the same so I wanted to know if there is a command to insert an image in a box with an offset so only part of the image shows?

Are you targeting the image object within the rectangle for the move command? Here are two examples one using the 'move' method the other by getting the 'bounds' and repositioning by changing those. If you get the bounds of the containing rectangle too then you should be able to use some math on how to fill & position within the rectangle.
set This_Image to choose file
tell application "Adobe InDesign CS2"
tell active document
tell page 1
tell rectangle 1
place This_Image
move image 1 by {-10, -10}
end tell
end tell
end tell
end tell
set This_Image to choose file
tell application "Adobe InDesign CS2"
tell active document
tell page 1
tell rectangle 1
place This_Image
set {Rect_T, Rect_L, Rect_B, Rect_R} to geometric bounds
set {Pict_T, Pict_L, Pict_B, Pict_R} to geometric bounds of image 1
set geometric bounds of image 1 to ¬
{Pict_T - 10, Pict_L - 10, Pict_B - 10, Pict_R - 10}
end tell
end tell
end tell
end tell

Similar Messages

  • How to add an image to combo box model in java

    i want to display a images.for that i take a combox.in that i want to add al images those i want to display, while clicking the image in combo box the image will be display.there is no problem for displaying an image, but i dont know how to add
    an image to a combo box model in net beans. please help me. if u have any idea plese forward to this mail
    [email protected]

    Hi Thomas,
                     You need to create an image field and in the source choose 'graphic content ; give the name of the variable which has the binary data . and give the type as 'MIME/image'.

  • Rich text box used in Infopath Form not displaying option to get images from Computer

    Hello,
    We have used "Rich text box" in Infopath Form which is not displaying option to get images from Computer.
    Options available are : From Address, From SharePoint
    But if we Rich text box in list, then it works fine with "From Computer" option.
    can you please help me out to get this option.
    Thanks in advance.
    REgards,
    Jayashri

    Hi,
    From your description, there is no “From Computer” option to get images with rich text box in InfoPath form.
    Per my knowledge, by design there are “From Address” and “From SharePoint” options without “From Computer” option in rich text box in InfoPath form. As a workaround, you can develop a custom InfoPath Rich Text box to do it.
    About developing a custom InfoPath control, I suggest you create a new thread on the forum “Visual Studio Tools for Office”, more experts will assist you with InfoPath development.
    Visual Studio Tools for Office:
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=vsto&filter=alltypes&sort=lastpostdesc
    Thanks,
    Dean Wang

  • How to display two different parts of one image in two windows?

    hi everyone:) i need to display two different parts of one image in two windows. i have problem with displaying :/ because after creating windows there aren't any images :( i supose my initialization code of creating windows is incomplete, maybe i miss something or maybe there is some inconistency. graphics in java is not my strong position. complete code is below. can anybody help me?
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;
    import java.util.*;
    class ImgFrame extends JFrame
           private BufferedImage img;
           ImgFrame(BufferedImage B_Img, int x, int y, int w, int h)
                   super("d");
                   img=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
                   img=B_Img.getSubimage(x, y, w, h);
           }//end ImgFrame construction
           public void paint(Graphics g)
                   Graphics2D g2D = (Graphics2D)g;
                   g.drawImage(img, 8, 8, null);
           }//end paint method
           public Dimension getPrefferedSize()
                   if(img==null)
                           return(new Dimension(100,100));
                   else
                           return(new Dimension(img.getWidth(null),img.getHeight(null)));
           }//end of GetPrefferedSize method
    }//end ImgFrame class
    public class TestGraph2D_03 extends Component
           static BufferedImage IMG;
           public static void Load()
                   try
                           IMG=ImageIO.read(new File("c:/test.bmp"));
                   catch(IOException ioe)
                           System.out.println("an exception: "+ioe);
                   }//end try catch
           }//end TestGraph2D_03 construction
           public static void main(String[] args)
                   Load();
                   ImgFrame F1 = new ImgFrame(IMG, 0, 0, 8, 8);
                   ImgFrame F2 = new ImgFrame(IMG, 8, 8, 8, 8);
                   F1.addWindowListener(new WindowAdapter()
                           public void windowClosing(WindowEvent e)
                                   System.exit(0);
                   F1.pack();
                   F1.setVisible(true);
                   F2.addWindowListener(new WindowAdapter()
                           public void windowClosing(WindowEvent e)
                                   System.exit(0);
                   F2.pack();
                   F2.setVisible(true);
           }//end of main method in TestGraph2D_01 class
    }//end of TestGraph2D_03 class

    Never override the paint(...) method of a Swing component.
    If you have a sub image then add the image to a JLabel and add the label to the GUI. No need for custom painting.

  • How to display different parts of an image

    hi,
    I need to display different parts of an image at specific situations.
    for example, a dice. there is only one image which includes different sides of the dice. and I wanna add
    to my panel one side if one comes, two side if two comes... I mean if one comes then we will display
    from 10 px to 80 px width and from 10 px to 80 px height of the dice image.
    is there any way to obtain this in java?
    thanks...

    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.util.Random;
    import javax.swing.*;
    public class ImageClipping extends JPanel {
        BufferedImage image;
        Rectangle clip;
        final int ROWS = 3;
        final int COLS = 3;
        public ImageClipping() {
            // Make an image we can clip.
            Dimension d = getPreferredSize();
            int type = BufferedImage.TYPE_INT_RGB;
            image = new BufferedImage(d.width, d.height, type);
            Graphics2D g2 = image.createGraphics();
            g2.setBackground(getBackground());
            g2.clearRect(0, 0, d.width, d.height);
            Font font = g2.getFont().deriveFont(36f);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("0", frc);
            float sh = lm.getAscent() + lm.getDescent();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            for(int j = 0; j < ROWS; j++) {
                for(int k = 0; k < COLS; k++) {
                    String s = String.valueOf(j*COLS + k+1);
                    float sw = (float)font.getStringBounds(s, frc).getWidth();
                    float sx = k*xInc + (xInc - sw)/2;
                    float sy = j*yInc + (yInc + sh)/2 - lm.getDescent();
                    g2.setPaint(Color.red);
                    g2.drawString(s, sx, sy);
                    g2.setPaint(Color.blue);
                    g2.drawRect(k*xInc, j*yInc, xInc-1, yInc-1);
            g2.dispose();
            clip = new Rectangle(xInc, yInc);
            // Inspect image.
            ImageIcon icon = new ImageIcon(image);
            JOptionPane.showMessageDialog(null, icon, "", -1);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Shape origClip = g2.getClip();
            //g2.setPaint(Color.red);
            //g2.draw(clip);
            // Draw clipped image at:
            int x = 100;
            int y = 100;
            // Mark location.
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(x-2,y-2,4,4));
            // Position the image.
            g2.translate(x-clip.x, y-clip.y);
            // Clip it and draw.
            g2.setClip(clip);
            g2.drawImage(image,0,0,this);
            // Reverse the changes to the graphics context.
            g2.setClip(origClip);
            g2.translate(clip.x-x, clip.y-y);
        public Dimension getPreferredSize() {
            return new Dimension(400,400);
        public static void main(String[] args) {
            ImageClipping test = new ImageClipping();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.pack();
            f.setLocation(50,50);
            f.setVisible(true);
            test.start();
        private void start() {
            Thread thread = new Thread(runner);
            thread.setPriority(Thread.NORM_PRIORITY);
            thread.start();
        private Runnable runner = new Runnable() {
            Random seed = new Random();
            Dimension d = getPreferredSize();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            public void run() {
                do {
                    try {
                        Thread.sleep(3000);
                    } catch(InterruptedException e) {
                        break;
                    int row = seed.nextInt(ROWS);
                    int col = seed.nextInt(COLS);
                    int x = col*xInc;
                    int y = row*yInc;
                    int n = row*COLS + col+1;
                    System.out.printf("row = %d  col = %d  n = %d%n",
                                       row, col, n);
                    clip.setLocation(x,y);
                    repaint();
                } while(isVisible());
    }

  • Drag and drop parts of an image

    Is there a way to display an image (such as a scanned page) and then have areas that can be dragged and dropped? For instance, suppose the scanned page has some text fields. I would like some of text fields in the scanned form to have boxes around them (perhaps a different color, perhaps marching ants) to indicate that they are fields of interest. I would like to be able to drag and drop one of those text fields onto another text field (probably on the right side of a split pane - this right panel is not a scanned image but a panel with real fields). I've seen information about dragging and dropping fields and images but not precisely this problem. Thanks for any help. I'm new to Swing and so am out of my league.

    You want the user to select the area? Sure that can be done fairly simply. You want the app to automatically figure out what parts of an image are what? That's not simple at all.
    Either way, it's not so much about swing as custom painting. Try checking this out:
    http://www.jhotdraw.org/

  • How to display dynamically generated SVG image

    Hello, I need some help on this issue...
    I need my page to display programmatically generated SVG image. but if i directly pass SVG string to the page like <h:outputText value="#{MyBean.SVGresult}"/> it will pop up a download dialog box. what should i do to properly include my svg into the page by using embed tag??

    The h:graphicImage does not appear to handle svg; maybe it should be extended. I'm still looking for the best way to do it. I don't know if I have the right solution but here is what I have done so far. This will throw up a x, y polyline graph.
    Put a panelGrid as place holder in the jsp
          <h:panelGrid  title="Report" style="color=black" border="0" id="dataReports" columns="1" binding="#{dataAnalysis.dataReport}">
          </h:panelGrid>Then take a 'template' svg and fill it in with the dynamic additions and changes in the backing bean. In a submit action
                    generateSVGGraph(twothetaArray, intensityArray);
                    UIColumn c=new UIColumn();
                    HtmlOutputText op=new HtmlOutputText();
                    op.getAttributes().put("style","color=black");
                    op.setTitle("header text");
                    op.setValue("header text");
                    c.setHeader(op);
                    //c.getFacets().put()
                    //c.getChildren().add("<embed src=\"../phase.svg\" align=\"left\" width=\"500\" height=\"500\" type=\"image/svg+xml\"/>");
                    //javax.faces.webapp.UIComponentBodyTag embed=new javax.faces.webapp.UIComponentBodyTag();
                    //javax.servlet.jsp.tagext.TagAdapter;
                    com.hypernex.jsf.ext.html.HtmlEmbedGraphic embedGraphic=new com.hypernex.jsf.ext.html.HtmlEmbedGraphic();
                    //embedGraphic.
                    embedGraphic.getAttributes().put("src","../session/phase"+phaseGraphCount+".svg");
                    embedGraphic.getAttributes().put("align","left");
                    embedGraphic.getAttributes().put("width","600");
                    embedGraphic.getAttributes().put("height","500");
                    embedGraphic.getAttributes().put("type","image/svg+xml");
                    c.getChildren().add(embedGraphic);
                     dataReport.getChildren().add(c);
                   c=new UIColumn();
                    op=new HtmlOutputText();
                    op.getAttributes().put("style","color=black");
                    op.setTitle("header text");
                    op.setValue("header text");
                    c.setHeader(op);
                    HtmlOutputText out=new HtmlOutputText();
                    out.getAttributes().put("style","color=black");
                    //out.setTitle("Figure 1.  Powder intensity as dependent on 2&theta;.");
                    out.setValue("Figure "+phaseGraphCount+".  Powder intensity as dependent on 2Theta.");
                    c.getChildren().add(out);
                    dataReport.getChildren().add(c);
    ...generateSVGGraph
        protected void generateSVGGraph(double[] x, double[] y)
            //FacesContext context = FacesContext.getCurrentInstance();
            //context.
            //Create an svg graph of the equation.
            org.apache.batik.dom.svg.SAXSVGDocumentFactory svgFactory=new org.apache.batik.dom.svg.SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
               org.apache.batik.dom.svg.SVGDOMImplementation svgDOMImplementation=new org.apache.batik.dom.svg.SVGDOMImplementation();
            org.w3c.dom.DocumentType dt=null;//svgDOMImplementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN",f.toURI().toString());
            //System.out.println(dt);
         org.w3c.dom.svg.SVGDocument svgOMDocument=null;
            try
                System.out.println("dir "+(new java.io.File(".")).toURI().toString());
                svgOMDocument=(org.w3c.dom.svg.SVGDocument)svgFactory.createDocument((new java.io.File("../webapps/jsf-wita/siteadmin/templates/graph-template.svg")).toURI().toString(), new java.io.FileInputStream(new java.io.File("../webapps/jsf-wita/siteadmin/templates/graph-template.svg")));//new org.apache.batik.dom.svg.SVGOMDocument(dt, (org.w3c.dom.DOMImplementation)svgDOMImplementation);
                org.w3c.dom.svg.SVGSVGElement root=svgOMDocument.getRootElement();
                        org.apache.batik.dom.svg.SVGOMGElement primary_g=new org.apache.batik.dom.svg.SVGOMGElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        primary_g.setAttribute("style","stroke:black; fill:none; stroke-width:1");
                        root.appendChild(primary_g);
                        //double[] x=new double[4*90];
                        //double[] y=new double[x.length];
                        //x[0]=(double)(1)/4.0;
                            //methodArgs[0]=new Double(Math.toRadians(x[0]));
                        //y[0]=((Double)method.invoke(mathmlObject, methodArgs)).doubleValue();
                        double xMin=x[0];
                        double yMin=y[0];
                        double xMax=x[x.length-1];
                        double yMax=xMax;
                        double xOfyMax=yMin;
                        StringBuffer points=new StringBuffer();
                        for(int index=0;index<x.length-1;index++)
                            //System.out.println(x[index]+" "+y[index]);
                            //x[index]=(double)(index+1)/4.0;
                            //methodArgs[0]=new Double(Math.toRadians(x[index]));
                            //y[index]=((Double)method.invoke(mathmlObject, methodArgs)).doubleValue();
                            double cx=x[index];
                            double cy=y[index];
                            //if(xMin>cx)xMin=cx;
                            if(yMin>cy)yMin=cy;
                            //if(xMax<cx)xMax=cx;
                            if(yMax<cy)
                             xOfyMax=cx;
                             yMax=cy;
                        org.w3c.dom.svg.SVGTextElement xLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xLabel");
                        xLabel.getFirstChild().setNodeValue("2?");//?");
                        org.w3c.dom.svg.SVGTextElement xMinimumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xMinimumLabel");
                        xMinimumLabel.getFirstChild().setNodeValue(ddf.format(xMin,4).toString());
                        org.w3c.dom.svg.SVGTextElement xMaximumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("xMaximumLabel");
                        xMaximumLabel.getFirstChild().setNodeValue(ddf.format(xMax,4).toString());
                        org.w3c.dom.svg.SVGTextElement yMinimumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("yMinimumLabel");
                        yMinimumLabel.getFirstChild().setNodeValue(ddf.format(yMin,4).toString());
                        org.w3c.dom.svg.SVGTextElement yMaximumLabel=(org.w3c.dom.svg.SVGTextElement)svgOMDocument.getElementById("yMaximumLabel");
                        yMaximumLabel.getFirstChild().setNodeValue(ddf.format(yMax,4).toString());
                        for(int index=0;index<x.length-1;index++)
                            points.append((x[index]-xMin)*500/(xMax-xMin));
                            points.append(",");
                            points.append((y[index]-yMin)*500/(yMax-yMin));
                            points.append(" ");
                        //System.out.println(points);
                        org.apache.batik.dom.svg.SVGOMGElement g=new org.apache.batik.dom.svg.SVGOMGElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        g.setAttribute("id",(String)"data");
                        g.setAttribute("transform", "translate(100, 550)");
                        g.setAttribute("style","stroke:black; fill:none; stroke-width:1");
                        org.apache.batik.dom.svg.SVGOMPolylineElement polyLine=new org.apache.batik.dom.svg.SVGOMPolylineElement("", (org.apache.batik.dom.AbstractDocument)svgOMDocument);
                        polyLine.setAttribute("fill", "none");
                        polyLine.setAttribute("stroke", "blue");
                        polyLine.setAttribute("transform", "scale(1, -1)");
                        polyLine.setAttribute("stroke-width", "1");
                        polyLine.setAttribute("points", points.toString());
                        g.appendChild(polyLine);
                        primary_g.appendChild(g);
                       javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance();
                       javax.xml.transform.Transformer intermediateTransformer=tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("../webapps/jsf-wita/stylesheets/identity.xsl"));
                                    intermediateTransformer.setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
                                    intermediateTransformer.setOutputProperty(OutputKeys.INDENT, "yes");
                         intermediateTransformer.transform(new javax.xml.transform.dom.DOMSource(svgOMDocument), new javax.xml.transform.stream.StreamResult(new java.io.FileOutputStream("../webapps/jsf-wita/session/phase"+phaseGraphCount+".svg")));
            catch(javax.xml.transform.TransformerConfigurationException tce)
                System.out.println("tce err: "+tce.getMessage());
            catch(javax.xml.transform.TransformerException te)
                System.out.println("te err: "+te.getMessage());
            catch(java.io.FileNotFoundException fnfe)
                System.out.println("fnfe:"+fnfe.getMessage());
            catch(java.io.IOException ioe)
                System.out.println("io:"+ioe.getMessage());
        HtmlEmbedGraphic.java
    * HtmlEmbedGraphic.java
    * Created on May 16, 2004, 8:12 AM
    package com.hypernex.jsf.ext.html;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    * @author  hyperdev
    public class HtmlEmbedGraphic extends javax.faces.component.UIComponentBase
        /** Creates a new instance of HtmlEmbedGraphic */
        public HtmlEmbedGraphic()
            super();
        public String getFamily()
            return "javax.faces.Data";
        public boolean isRendered()
            return true;
    public void encodeBegin(FacesContext context,
      UIComponent component) throws java.io.IOException {
      if ((context == null) || (component == null)){
          System.out.println("encodeBegin NullPointerException "+context);
        throw new NullPointerException();
          System.out.println("encodeBegin "+context+" "+component);
      //MapComponent map=(MapComponent) component;
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("embed", this);
      writer.writeAttribute("src", getAttributes().get("src"),"id");
    public void encodeEnd(FacesContext context) throws java.io.IOException {
      if ((context == null)){
        throw new NullPointerException();
      //MapComponent map = (MapComponent) component;
      ResponseWriter writer = context.getResponseWriter();
      writer.startElement("embed", this);
      writer.writeAttribute("src", getAttributes().get("src"),"id");
      writer.writeAttribute("align", getAttributes().get("align"),"id");
      writer.writeAttribute("width", getAttributes().get("width"),"id");
      writer.writeAttribute("height", getAttributes().get("height"),"id");
      writer.writeAttribute("type", getAttributes().get("type"),"id");
      writer.endElement("embed");
    }graph-template.svg - More static parts of the graphic can be put in here.
    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" width="100%" zoomAndPan="magnify" contentStyleType="text/css" viewBox="0 0 600% 600%" height="100%" preserveAspectRatio="xMidYMid meet" version="1.0">
    <g style="stroke:black; fill:none; stroke-width:1">
    <g id="visuals" style="stroke:black; fill:none; stroke-width:1" transform="translate(100, 550)">
    <rect id="box" transform="scale(1, -1)" x="1" y="1" width="500" height="500" fill="none" stroke="black" stroke-width="1.5"/>
    <g id="labels" transform="scale(1, 1)">
    <text id="xLabel" x="250" y="50" text-anchor="middle"
            font-family="Verdana" font-size="24" fill="blue" >x label</text>
    <text id="xMinimumLabel" x="0" y="20" text-anchor="middle"
            font-family="Verdana" font-size="18" fill="blue" >0.0</text>
    <text id="xMaximumLabel" x="500" y="20" text-anchor="middle"
            font-family="Verdana" font-size="18" fill="blue" >100.0</text>
    <text id="yMinimumLabel" x="-3" y="-3" text-anchor="end"
            font-family="Verdana" font-size="18" fill="blue" >0.0</text>
    <text id="yMaximumLabel" x="-3" y="-500" text-anchor="end"
            font-family="Verdana" font-size="18" fill="blue" >100.0</text>
    </g>
    </g>
    <g id="data" style="stroke:black; fill:none; stroke-width:1" transform="translate(10, 550)">
    </g>
    </g>
    </svg>

  • My Photoshop CS 5 has some strange actions when I copy a portion of a photo using the clone stamp  to transfer to another part of the image. It carries the entire layer (not just the stamps selection) across the screen and I cannot place it where I need t

    My Photoshop CS 5 has some strange actions when I copy a portion of a photo using the clone stamp  to transfer to another part of the image. It carries the entire layer (not just the stamps selection) across the screen and I cannot place it where I need to. It appears as if I selected the entire layer on purpose (which I did not)
    The below items appeared when I opened Photoshop CS 5:
    “Photoshop has encountered a problem with the display driver and has temporarily disabled G & U enhancements. Check the video card malfunctions website for latest software. GPU enhancements can be enabled in the performance panel of preferences.”
    (I believe this started after the automatically updated Windows was applied. It was coincident with the before mentioned problem . . . but I don’t really know if it had anything to do with it. )

    For the Clone Stamp problem, check the Clone Source panel and Clipped is probably unchecked.
    If so, check Clipped and see if that makes a difference.
    (Window>Clone Source)
    As to the video card problem:
    Which version of windows are you using?
    What is the make and model of your graphics card?
    Do you know which update windows installed?

  • In iPhoto, how can I export images with the metadata - including the title and caption information - intact as part of the image?

    In iPhoto, how can I export images with the metadata — including the title and caption information — intact as part of the image?

    Check those boxes in the export dialogue - Exporting From iPhoto
    LN

  • Display an object of Image type or Byte Array

    Hi, lets say i got an image stored in the Image format or byte[]. How can i make it display the image on the screen by taking the values in byte array or Image field?

    Thanks rahul,
    The thing is, i am generating a chart in a servlet
    and setting the image in the form of a byte [] to the
    view bean ( which is binded to the jsp, springs
    framework ). The servlet would return the view bean
    to the jsp and in the jsp, i am suppose to print this
    byte array so as to give me the image..
    I hope this makes sense.. pls help me ou!Well letme see if i got tht right or not,
    you are trying to call Your MODEL (Business layer / Spring Container) from a servlet and you are expressing that logic in form of chart (Image) and trying to save it as a byte array in a view bean and you want to print /display that as an image in a jsp (After Servlet fwd / redirect action) which includes other data using a ViewBean.
    If this is the case...
    As the forwaded JSP can include both image and Textual (hypertext too)..we can try a work around hear...Lets dedicate a Servlet which retreives byte [] from a view bean and gives us an image output. hear is an example and this could be a way.
    Prior to that i'm trying to make few assumptions here....
    1).The chart image which we are trying to express would of format JPEG.
    2).we are trying to take help of<img> tag to display the image from the image generating servlet.
    here is my approach....
    ViewBean.java:
    ============
    public class ViewBean implements serializable{
    byte piechart[];
    byte barchart[];
    byte chart3D[];
    public ViewBean(){
    public byte[] getPieChart(){
    return(this.piechart);
    public byte[] getBarChart(){
    return(this.barchart);
    public byte[] get3DChart(){
    return(this.chart3D);
    public void setPieChart(byte piechart[]){
    this.piechart = piechart;
    public void setBarChart(byte barchart[]){
    this.barchart = barchart;
    public void set3DChart(byte chart3D[]){
    this.chart3D = chart3D;
    }ControllerServlet.java:
    =================
    (This could also be an ActionClass(Ref Struts) a Backing Bean(Ref JSF) or anything which stays at the Controller Layer)
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
    /* There are few different implementations of getting   BeanFactory Resource
    In,the below example i have used XmlBeanFactory Object to create an instance of (Spring) BeanFactory */
    BeanFactory factory =
    new XmlBeanFactory(new FileInputStream("SpringResource.xml"));
    //write a Util Logic in your Implementation class using JFreeChart (or some open source chart library) and express the images by returning a  byte[]
    ChartService chartService =
    (GreetingService) factory.getBean("chartService");
    ViewBean vb = new ViewBean();
    vb.setPieChart(chartService.generatePieChart(request.getParameter("<someparam>"));
    vb.setBarChart(chartService.generateBarChart(request.getParameter("<someparam1>"));
    vb.set3DChart(chartService.generate3DChart(request.getParameter("<someparam2>"));
    chartService = null;
    HttpSession session = request.getSession(false);
    session.setAttribute("ViewBean",vb);
    response.sendRedirect("jsp/DisplayReports.jsp");
    }DisplayReports.jsp :
    ================
    <%@ page language="java" %>
    <html>
    <head>
    <title>reports</title>
    </head>
    <body>
    <h1 align="center">Pie Chart </h1>
    <center><img src="ImageServlet?req=1" /></center>
    <h1 align="center">Bar Chart </h1>
    <center><img src="ImageServlet?req=2" /></center>
    <h1 align="center">3D Chart</h1>
    <center><img src="ImageServlet?req=3" /></center>
    </body>
    </html>ImageServlet.java
    ==============
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
           byte buffer[];
            HttpSession session = request.getSession(false);
            ViewBean vb = (ViewBean) session.getAttribute("ViewBean");
            String req = request.getParameter("req");
            if(req.equals("1") == true)       
                buffer = vb.getPieChart();
            else if(req.equals("2") == true)
                 buffer = vb.getBarChart();
            else if(req.equals("3") == true)
                 buffer = vb.get3DChart();
            JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(buffer));
            BufferedImage image =decoder.decodeAsBufferedImage() ;
            response.setContentType("image/jpeg");
            // Send back image
            ServletOutputStream sos = response.getOutputStream();
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
            encoder.encode(image);
        }Note: Through ImageServlet is a Servlet i would categorise it under presentation layer rather to be a part of Controller and added to it all this could be easily relaced by a reporting(BI) server like JasperServer,Pentaho,Actuate................
    Hope the stated implementation had given some idea to you....
    However,If you want to further look into similar implementations take a look at
    http://www.swiftchart.com/exampleapp.htm#e5
    which i believe to be a wonderful tutor for such implementations...
    However, there are many simple (Open) solutions to the stated problem.. if you are Using MyFaces along with spring... i would recommend usage of JSF Chart Tag which is very simple to use all it requires need is to write a chart Object generating methos inside our backing bean.
    For further reference have a look at the below links
    http://www.jroller.com/page/cagataycivici?entry=acegi_jsf_components_hit_the
    http://jsf-comp.sourceforge.net/components/chartcreator/index.html
    NOTE:I've tried it personally using MyFaces it was working gr8 but i had a hardtime on deploying my appln on a Portal Server(Liferay).If you find a workaround i'd be glad to know about it.
    & there are many BI Open Source Server Appls that can take care of this work too.(Maintainace wud be a tough ask when we go for this)
    For, the design perspective had i've been ur PM i wud have choose BI Server if it was corporate web appln on which we work on.
    Hope this might be of some help :)
    REGARDS,
    RaHuL

  • Display SWFs instead of images?

    Hi all,
    I built some dynamic pages using ADDT, and on some of the pages, the customer wants .swf files to display instead of an image. I added a field in my mysql database that holds the path to the flash files (for example...."flash/file-1.swf"), and then I tried to put a "placeholder" and bind the field from the recordset I created. However, this didnt work.
    Is there a way to pull and place an swf onto a dynamic page like this? What am I doing wrong?
    Any help is appreciated
    John

    Hi Shane,
    I didnt think it would be hard to do either, and maybe its just because I am juggling 5 other projects that I dont have the focus right now and its making this more difficult.
    Ok, I can post code but Ill tell you what I did. I created several flash files for each page (i.e. 1.swf, 2.swf, 3.swf, etc) and then in my MySQL database, I added a field to hold the path to those files for each page.
    In my page I created a filtered recordset. I place in the swf file where i wanted it and then went to the file field (this is in Dreamweaver) then opened the dialog box. Then I hit "Data Sources" and selected the correct field from my recordset that holds the path in the db.
    When I got to test the page, nothing comes up where the swf should be. When I look at the code, it is correctly bringing up the source from the database, its just not showing the file.
    Any ideas?

  • I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    Just go back in photoshop and use the Slice Select tool, then just click and select the slice and hit delete - if you're not sure which one is the active slice just right click and find the one that has the Delete Slice option.
    It's possible you either added the slices by accident or if you received it from someone they just had the slices hidden. For the future, you can go to View > Show > Slices to display (or hide) slices.

  • Converting part of an image to Grayscale (black & white)

    Q. I want to make part of an image grayscale but keep some color elements.
    Answer: There is always more than one way to do something in Photoshop.
    #1 Select the area you want to be grayscale. Create a new Hue/Saturation Adjustment Layer (half-moon icon in the Layers palette). Dial down the Saturation.
    #2 Make a copy of your image and make it Grayscale.
    After creating a layer in the color image with just the part of your image you want to still be color paste the Grayscale image under this layer.
    Your image will still be a color image with elements that look grayscale.
    #3 In CS3 (version 10 ) use Image > Adjustments > Black & White

    It's all virtual right now. Various issues keep the points from being displayed, but it does contribute to the "level" setup which at some point will function (I'm guessing) much like the "old system" where you get certain bonuses (personal avatars, etc) depending on the "level" you are in the system.
    I'm already a level 4, so points only contribute to my "reputation", I guess. But TPTB have suggested that we inform users of the Forum on the proper way to use it to build a better community.
    Thanks for the "Solved"
    Patrick

  • InDesign only showing part of the image

    I'm doing a job for a client in InDesign CS5. I have not worked in CS5 before, so don't know if this is a bug or if I'm doing something wrong.
    It seems to happen randomly and I have checked the preferences and tried using different settings for the Display Performance. I've even tried viewing the job with Overprint Preview switched on.
    When placing images only a part of the image shows. When I output to PDF or Print the file then the entire image shows. This makes it very hard to do layouts, especially in cases where I need to crop an image.
    In InDesign it looks like this:
    When I output to PDF (this is a low res output, just to demonstrate my point) the entire image shows:
    In InDesign it looks like this:
    When I output to PDF:
    The machine I'm ding this job on is an iMac, 2.66GHz Intel Core 2 Duo with 4GB 800MHZ DDR2 SDRAM. It is running Mac OSX 10.6.4. And InDesign is on version 7.0.2.

    mafeiteng wrote:
    I'm doing a job for a client in InDesign CS5. I have not worked in CS5 before, so don't know if this is a bug or if I'm doing something wrong.
    It seems to happen randomly and I have checked the preferences and tried using different settings for the Display Performance. I've even tried viewing the job with Overprint Preview switched on.
    When placing images only a part of the image shows. When I output to PDF or Print the file then the entire image shows. This makes it very hard to do layouts, especially in cases where I need to crop an image.
    In InDesign it looks like this:
    When I output to PDF (this is a low res output, just to demonstrate my point) the entire image shows:
    In InDesign it looks like this:
    When I output to PDF:
    The machine I'm ding this job on is an iMac, 2.66GHz Intel Core 2 Duo with 4GB 800MHZ DDR2 SDRAM. It is running Mac OSX 10.6.4. And InDesign is on version 7.0.2.
    If I understand things correctly, you're placing client-supplied images into a new InDesign file that you're creating, so the only part of the workflow that you haven't created is the graphics. This logically leaves the container file innocent.
    The question becomes "what's up with either the hardware or the graphics?" If the problem persists with the same graphic files and a new container file on a different user account on the same computer, it's possible that hardware is the villain. If it doesn't persist on a different computer, it's likely the hardware. If it does persist on a different computer, in a new container file, it's likely something in the graphics files.
    It's not clear if the graphics card in your iMac is one of the models whose video RAM is "dedicated," that is, it doesn't share video RAM with the main RAM, or if it does share VRAM. If it shares RAM, it's possible that 4GB isn't sufficient to display all the open applications and their demands. If this is the cause, it's a hardware issue (insufficient RAM.)
    Because the graphics print and convert to PDF without the problem, it would seem that the graphics are innocent, but perhaps something in the processing of these outputs causes the problem to disappear. For example, perhaps there's some flattening involved. Perhaps there's a clipping path or channel mask of some kind involved that affects the InDesign display? (Just fishing.)
    Have you tried opening the graphics in their creating application and saving them to new names? Any difference in the behavior when those graphics are freshly-placed in InDesign, or when their links are updated?
    Have you tried placing PDFs of the graphics? If they appear properly, can you crop them to achieve your requirements and hope the problem goes away after the deadline passes<G>?
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Selecting part of the image

    Hello,
    I have image present in ImageIcon. I want to select the part of the image in it using Mouse? I want to drag and select it....
    Can anyone help me in finding this?
    Thanks,
    Sri

    Geez, you post a question late Sunday night and want an answer early Monday morning. Contrary to public opinion many of us do have lives away from these forums.
    What have you done on this requirement so far? Can you display the ImageIcon? You can use MouseListener and MouseMotionListener to define the subimage to select.
    Start off with that and post specific questions for more detailed help.
    Cheers
    DB

Maybe you are looking for

  • My iPhone was stolen. How can I get my downloaded music which had not been transferred to my laptop

    My iPhone was stolen.  How can I get my downloaded music if I had not transferred it to my laptop (not an iMac so no iCloud )

  • SOAP Receiver Adapter Proxy Settings

    Hi Guys, I am trying to send a SOAP message to an external webservice. I was able to get the message to arrive at the webservice when I used a proxy without user authenication. I now need to get the SOAP adapter to use a proxy with user authenication

  • Sorting audiobooks on ipod

    hello, so i have downloaded an audiobook and imported it into itunes. i have converted it to m4b. so now my audiobook appears in itunes under audiobooks. so i go to my ipod select the only audiobook i have. then it shows me about 300 tracks that make

  • Shuffle music videos?

    Is there no function that makes it possible to shuffle the music videos purchased? Its annoying to press play everytime a video is finished, it would be nice to be able to shuffle the videos like the songs....

  • Lightroom Mobile - sync 2 computers?

    Hi there, I have 2 computers - 1) iMac, which is my main computer, and 2) MacBook Pro which I drag around with me everywhere. I'd welcome the opportunity to sync the catalog on my iMac with my MacBook Pro, so that I can edit & retouch images while on