Save only the bounding box region of image as png?

Hi,
I'd like to save each layer's item as png.
If possible, i'd like save only the bounding box of image(of an item), and the corresponding bounding box's origin/size info(relative to artboard's origin) somewhere as text file.
To do this,
I need to be able to get a bounding box of an item.
and possibly artboard's origin. (because I'm not sure where a bounding box's coordinate's origin is).
Thank you in advance

If I understand you correctly you have one table with a bunch of yes/no values (SA, SC, SS, etc.).  Then for each record in that table you want to output a string listing all the fields from the first table which = yes (i.e are checked).  Perhaps
the following code would get you started:
Sub JimNeal()
    Dim strProcedure_Value As String
    Dim rst As DAO.Recordset
    Dim rstOut As DAO.Recordset
    Set rst = DBEngine(0)(0).OpenRecordset("TableWithCheckboxes")
    Set rstOut = DBEngine(0)(0).OpenRecordset("OutputTable")
    Do Until rst.EOF
        strProcedure_Value = ""
        If rst!SA Then strProcedure_Value = strProcedure_Value & "Surface Area,"
        If rst!SC Then strProcedure_Value = strProcedure_Value & "Surface Contour,"
        '... etc
        If rst!SS Then strProcedure_Value = strProcedure_Value & "Steep Slope,"
        rst.MoveNext
        ' Strip off final comma
        If Len(strProcedure_Value) > 0 Then strProcedure_Value = Left(strProcedure_Value, Len(strProcedure_Value) - 1)
        ' Output the string to your output table
        rstOut.AddNew
        rstOut!Procedure_Value = strProcedure_Value
        rstOut.Update
    Loop
    rst.Close
    rstOut.Close
    Set rst = Nothing
    Set rstOut = Nothing
End Sub
-Bruce

Similar Messages

  • Can PB can calcute the bounding box as the needed region in AE?

    Hi,
    I wrote many small pixel bender that I use mainly in AE. However I need them to be as efficient as possible, so I wonder if Pixel Bender can obtain the bounding box of an image input as the needed region. This way, it will not calculate an entire frame when there is only a few pixels in the frame.
    Thanks
    Jocelyn Tremblay

    Hi,
    I did a major breakthrough by rethinking the model. Now I get a real speed improvment, and if the image is fully opaque, there is not too much drawback.
    Instead of a simple bounding box, I'm creating a grid in which each cell represent a region of the source and is float4(1). if there is any non-zero transparent pixel. In the last kernel of the graph, i'm processing only when the corresponding value in the grid is float4(1.). I get really efficient results from that. I'm including two graphs. A basic one with a fixed grid of 16px (I didn't do any beanchmark for the grid size) where I output the original image composited over the scaled grid in green. The second one, where the last kernel is a box blur, the grid size equal the blur radius, and there is a convolution kernel between the grid and the box blur that expand the grid to fit the blur.
    GridExperience.pbg
    <?xml version="1.0" encoding="utf-8"?>
    <graph name = "GridExperience" xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">
        <metadata name = "namespace" value =  "com.jocelyntremblay"/>
        <metadata name = "vendor" value = "Jocelyn Tremblay" />
        <metadata name = "version" type = "int" value = "1" />
        <!-- Image inputs and outputs of the graph -->
        <inputImage type = "image4" name = "src" />
        <outputImage type = "image4" name = "dst" />
        <!-- Graph parameters -->
        <parameter type="float2" name="sourceSize" >
            <metadata name="minValue" type="float2" value="1"/>
            <metadata name="maxValue" type="float2" value="4096" />
            <metadata name="defaultValue" type="float2" value="634., 396." />
            <metadata name="aeUIControl" value="aePoint" />
            <metadata name="aePointRelativeDefaultValue" type="float2" value="1, 1" />
        </parameter>
            <!-- Graph parameters -->
        <parameter type="float" name="gridSize" >
            <metadata name="minValue" type="float" value="1"/>
            <metadata name="maxValue" type="float" value="64" />
            <metadata name="defaultValue" type="float" value="16" />
        </parameter>
         <!-- Embedded kernel -->
         <kernel>
          <![CDATA[
             <languageVersion : 1.0;>
             kernel getProcessingGrid
             <  
                namespace:"com.jocelyntremblay";
                vendor:"Jocelyn Tremblay";
                version:1;
             >{
                input image4 src;
                output float4 dst;
                parameter float2 sourceSize
                <
                    parameterType : "inputSize";
                    inputSizeName : "src";
                >;
                parameter float gridSize
                <
                    minValue:float(1.0);
                    maxValue:float(64.0);
                    defaultValue:float(5.0);
                >;
                region changed(region inputRegion, imageRef inputIndex){
                    return region(float4(0, 0, ceil(sourceSize.x/gridSize), ceil(sourceSize.y/gridSize)));
                void evaluatePixel(){
                    float j;
                    float4 pix;
                    dst = float4(0.0);
                    for (float i = 0.; i < gridSize; i++){
                        j = 0.;
                        for (j; j < gridSize; j++){
                            pix = sampleNearest(src, float2(floor(outCoord().x) * gridSize + i, floor(outCoord().y) * gridSize + j));
                            if (pix.a > 0.){
                                dst = float4(1.0);
                                i = j = gridSize;
          ]]>
         </kernel>
         <kernel>
          <![CDATA[
             <languageVersion : 1.0;>
             kernel drawProcessingGrid
             <  
                namespace:"com.jocelyntremblay";
                vendor:"Jocelyn Tremblay";
                version:1;
             >{
                input image4 src;
                input image4 processingGrid;
                output float4 dst;
                parameter float gridSize
                <
                    minValue:float(1.0);
                    maxValue:float(64.0);
                    defaultValue:float(5.0);
                >;
                void evaluatePixel(){
                    float4 gridSegment = sampleNearest(processingGrid, float2(floor(outCoord().x/gridSize), floor(outCoord().y/gridSize)));
                    if (gridSegment.a > 0.){
                                    //process
                                    dst = float4(0., 1., 0., 1.);
                                    float4 tt = sampleNearest(src, outCoord());
                                    if(tt.a > 0.){
                                        dst.rgb = tt.rgb;
                    else{
                        //do not process
                        dst = float4(0.);
          ]]>
         </kernel>
        <!-- Instances of the nodes -->
        <node id = "getProcessingGrid" name ="getProcessingGrid" namespace = "com.jocelyntremblay" vendor = "Jocelyn Tremblay" version ="1">
        <evaluateParameters>
                <![CDATA[void evaluateParameters() {
                    getProcessingGrid::gridSize = gridSize;
                    getProcessingGrid::sourceSize = sourceSize;
                }]]>
            </evaluateParameters>
        </node>
        <node id = "drawProcessingGrid" name ="drawProcessingGrid" namespace = "com.jocelyntremblay" vendor = "Jocelyn Tremblay" version ="1">
        <evaluateParameters>
                <![CDATA[void evaluateParameters() {
                    drawProcessingGrid::gridSize = gridSize;
                }]]>
            </evaluateParameters>
        </node>
        <!-- Connect the graph -->
        <connect fromImage = "src" toNode = "getProcessingGrid" toInput = "src" />
        <connect fromImage = "src" toNode = "drawProcessingGrid" toInput = "src" />
        <connect fromNode = "getProcessingGrid" fromOutput = "dst" toNode = "drawProcessingGrid" toInput = "processingGrid" />
        <connect fromNode = "drawProcessingGrid" fromOutput = "dst" toImage = "dst" />
    </graph>
    GridExperienceBoxBlur.pbg
    <?xml version="1.0" encoding="utf-8"?>
    <graph name = "GridExperienceBoxBlur" xmlns="http://ns.adobe.com/PixelBenderGraph/1.0">
        <metadata name = "namespace" value =  "com.jocelyntremblay"/>
        <metadata name = "vendor" value = "Jocelyn Tremblay" />
        <metadata name = "version" type = "int" value = "1" />
        <!-- Image inputs and outputs of the graph -->
        <inputImage type = "image4" name = "src" />
        <outputImage type = "image4" name = "dst" />
        <!-- Graph parameters -->
        <parameter type="float2" name="sourceSize" >
            <metadata name="minValue" type="float2" value="1"/>
            <metadata name="maxValue" type="float2" value="4096" />
            <metadata name="defaultValue" type="float2" value="1920., 720." />
            <metadata name="aeUIControl" value="aePoint" />
            <metadata name="aePointRelativeDefaultValue" type="float2" value="1, 1" />
        </parameter>
        <parameter type="float" name="blurRadius" >
            <metadata name="minValue" type="float" value="0"/>
            <metadata name="maxValue" type="float" value="25" />
            <metadata name="defaultValue" type="float" value="5" />
        </parameter>
         <!-- Embedded kernel -->
         <kernel>
          <![CDATA[
             <languageVersion : 1.0;>
             kernel getProcessingGrid
             <  
                namespace:"com.jocelyntremblay";
                vendor:"Jocelyn Tremblay";
                version:1;
             >{
                input image4 src;
                output float4 dst;
                parameter float2 sourceSize
                <
                    parameterType : "inputSize";
                    inputSizeName : "src";
                >;
                parameter float gridSize
                <
                    minValue:float(1.0);
                    maxValue:float(64.0);
                    defaultValue:float(16.0);
                >;
                region changed(region inputRegion, imageRef inputIndex){
                    return region(float4(0, 0,  ceil(sourceSize.x/gridSize), ceil(sourceSize.y/gridSize)));
                void evaluatePixel(){
                    float j;
                    float4 pix;
                    dst = float4(0.0);
                    for (float i = 0.; i < gridSize; i++){
                        j = 0.;
                        for (j; j < gridSize; j++){
                            pix = sampleNearest(src, float2(floor(outCoord().x) * gridSize + i, floor(outCoord().y) * gridSize + j));
                            if (pix.a > 0.){
                                dst = float4(1.0);
                                i = j = gridSize;
          ]]>
         </kernel>
         <kernel>
          <![CDATA[
             <languageVersion : 1.0;>
            kernel ConvKernel
            <
            namespace: "After Effects";
            vendor : "Adobe Systems Inc.";
            version : 1;
            description : "Convolves an image using a smoothing mask";
            >
                input image4 source;
                output pixel4 result;
                const float3x3 smooth_mask = float3x3( 1.0, 1.0, 1.0,
                1.0, 1.0, 1.0,
                1.0, 1.0, 1.0);
                const float smooth_divisor = 9.0;
                float4 convolve(float3x3 in_kernel, float divisor) {
                    float4 conv_result = float4(0.0, 0.0, 0.0, 0.0);
                    float2 out_coord = outCoord();
                    for(int i = -1; i <= 1; ++i) {
                        for(int j = -1; j <= 1; ++j) {
                            conv_result += sampleNearest(source,
                            out_coord + float2(i, j)) * in_kernel[i + 1][j + 1];
                    conv_result /= divisor;
                    return conv_result;
                void evaluatePixel() {
                    float4 conv_result = convolve(smooth_mask, smooth_divisor);
                    result = conv_result;
                region needed( region output_region, imageRef input_index ) {
                    region result = output_region;
                    result = outset( result, float2( 1.0, 1.0 ) );
                    return result;
                region changed( region input_region, imageRef input_index ) {
                    region result = input_region;
                    result = outset( result, float2( 1.0, 1.0 ) );
                    return result;
            } //kernel ends
            ]]>
          </kernel>
          <kernel>
          <![CDATA[
             <languageVersion : 1.0;>
                kernel BasicBoxBlur
                <   namespace : "AIF";
                    vendor : "Adobe Systems";
                    version : 2;
                    description : "variable Radius Box Blur"; >
                input image4 src;
                input image4 processingGrid;
                output float4 dst;
                parameter float blurRadius
                <
                    minValue:float(0.0);
                    maxValue:float(25.0);
                    defaultValue:float(5.0);
                >;
                dependent int radiusAsInt;
                void evaluateDependents(){
                    radiusAsInt = int(ceil(blurRadius));
                parameter float gridSize
                <
                    minValue:float(1.0);
                    maxValue:float(64.0);
                    defaultValue:float(16.0);
                >;
                region needed(region outputRegion, imageRef inputRef){
                    float2 singlePixel = pixelSize(src);
                    return outset(outputRegion, float2(singlePixel.x * ceil(blurRadius), singlePixel.y * ceil(blurRadius)));
                region changed(region inputRegion, imageRef inputRef){
                    float2 singlePixel = pixelSize(src);
                    return outset(inputRegion, float2(singlePixel.x * ceil(blurRadius), singlePixel.y * ceil(blurRadius)));
                void evaluatePixel(){
                    float4 gridSegment = sampleNearest(processingGrid, float2(floor(outCoord().x/gridSize), floor(outCoord().y/gridSize)));
                    if (gridSegment.a > 0.){
                        float denominator = 0.0;
                        float4 colorAccumulator = float4(0.0, 0.0, 0.0, 0.0);             
                        float2 singlePixel = pixelSize(src);
                        for(int i = -radiusAsInt; i <= radiusAsInt; i++)
                            for(int j = -radiusAsInt; j <= radiusAsInt; j++)
                                colorAccumulator += sampleNearest(src,
                                    outCoord() + float2(float(i) * singlePixel.x, float(j) * singlePixel.y));
                                denominator++;
                        dst = colorAccumulator / denominator;
                    else{
                        //do not process
                        dst = float4(0.);
          ]]>
         </kernel>
        <!-- Instances of the nodes -->
        <node id = "getProcessingGrid" name ="getProcessingGrid" namespace = "com.jocelyntremblay" vendor = "Jocelyn Tremblay" version ="1">
        <evaluateParameters>
                <![CDATA[void evaluateParameters() {
                    getProcessingGrid::sourceSize = sourceSize;
                    getProcessingGrid::gridSize = max(1., blurRadius);
                }]]>
            </evaluateParameters>
        </node>
        <node id = "ConvKernel" name ="ConvKernel" namespace = "After Effects" vendor = "Adobe Systems Inc." version ="1"></node>
        <node id = "BasicBoxBlur" name ="BasicBoxBlur" namespace = "AIF" vendor = "Adobe Systems" version ="2">
        <evaluateParameters>
                <![CDATA[void evaluateParameters() {
                    BasicBoxBlur::blurRadius = blurRadius;
                    BasicBoxBlur::gridSize = max(1., blurRadius);
                }]]>
            </evaluateParameters>
        </node>
        <!-- Connect the graph -->
        <connect fromImage = "src" toNode = "getProcessingGrid" toInput = "src" />
        <connect fromImage = "src" toNode = "BasicBoxBlur" toInput = "src" />
        <connect fromNode = "getProcessingGrid" fromOutput = "dst" toNode = "ConvKernel" toInput = "source" />
        <connect fromNode = "ConvKernel" fromOutput = "result" toNode = "BasicBoxBlur" toInput = "processingGrid" />
        <connect fromNode = "BasicBoxBlur" fromOutput = "dst" toImage = "dst" />
    </graph>

  • Forcing onPress to react on the exact shape, rather then on the bounding box

    If I have a clip with an imported image then clip.onPress
    reacts on the
    bounding box of the clip rather then on the exact shape of
    the imported
    image even if the imported image has a transparent
    background.
    To make it to react to in image shape only I have to use
    Trace BitMap which
    results in deterioration of the image quality and if the clip
    is moving,
    Trace BitMap also slows down computer perfprmance.
    Is there other technique to make onPress to react on the
    exact shape, rather
    then on the bounding box?

    An image is always rectangular, it just may have transparent
    parts. So an MC containing an image is always as big as the whole
    image (at least).
    You could use the MovieClip.hitArea property, and create
    another MC inside your clip that specifies the active area for
    mouse clicks. This is easy if you have the image loaded into the
    clip inside the Flash IDE.
    If it's loaded on runtime, you might use the BitmapData class
    (if you use Flash 8) to get the pixel value of the image at the
    position where the image was clicked, check if it's transparent or
    opaque, and decide whether to call the onPress action or not.
    hth,
    blemmo

  • Can see the bounding box of the object present on the art-board but the colors of that object are not visible!!!! Why???

    I have made some objects in 8-bit design style using rectangular grid tool.
    I was working on the file, and i saved the file, and then illustrator crashed, and all the data in the 8 bit grid wasn't showing up, only the bounding boxes(rectangular-grid) of those 8-bit designed objects were present with no color/no fill.
    I am attaching some screenshots and jpegs to show how it was before and how it is now.
    Can somebody help me out in this?

    Illustrator crashed when saving and most probably took some of your file with it.
    Do you have a backup copy?

  • Why are my Illustrator images getting thicker strokes when I take the bounding box and make them smaller?

    Why are my Illustrator images getting thicker strokes when I take the bounding box and make them smaller? This has never happened to me. I'm not an expert at Illustrator, but I do know some fundamentals.

    Thank you for responding so quickly. No apologies necessary - I know this Forum isn't McDonalds - don't expect an answer to be served up right away. You helped me out with a big issue yesterday.
    I am using a mac - OSX 10.7.5
    I have Adobe Creative Suites - CS5 - Illustrator version is 15.0.2
    The contents I am placing are all  Vector - Illustrator files
    But, I wonder about some of the vector files I work with.  Could a "line weight/thickness" be 'assigned' to the drawing and screw things up? I used 'simple' linear (line) drawings from SolidWorks that have been converted to ai files. It's just weird because I checked the stroke of the drawing and it's not out of line.
    I am attaching part of some box labels. You can see how the drawings, of the products, on the 'left side' are "thick" after embedding them. I think the "Global Logo" was pasted into a template not linked that's why it's okay. But look at the Quiet Thunder logo - it looks terrible. These labels are only 2.25" X 6.5", so its important I keep the images lightweight. 
    Your help is very much appreciated. Thank you!

  • I have 4 equal oblong shape created with borders How do I go about knowing what size the selection area is so that I can crop an image to fit. I don't want to use paste in then adjust the bounding box to suit

    I have 4 equal oblong shape created with borders How do I go about knowing what size the selection area is so that I can crop an image to fit. I don't want to use paste in then adjust the bounding box to suit

    What do you mean a moderator

  • Can an image in the slideshow widgets be moved around inside the bounding box as can be in a normal image placed into Muse (double clicking on a placed image gives the functionality to move the image around - as per Indesign functionality)

    Can an image in the slideshow widgets be moved around inside the bounding box as can be in a normal image placed into Muse (double clicking on a placed image gives the functionality to move the image around - as per Indesign functionality)

    Can an image in the slideshow widgets be moved around inside the bounding box as can be in a normal image placed into Muse (double clicking on a placed image gives the functionality to move the image around - as per Indesign functionality)

  • Getting the bounds of a drawn image on a panel

    Hello, I have a problem with getting the bounds of a drawn image on a panel...Since it is drawn as graphics, i tried getClipBounds and since my class extends JPanel i tried to get the bounds from the panel but neither of them worked properly. It only gets the bounds of a jframe that contains the panel.Then i tried to put the panel in a layeredpane and then a container; but this time the image disappeared completely. Hope someone can help or tell me what I am doing wrong. Thanks in advance. Here is the code below:
    By the way what I am trying to do in this code is basically zooming the image in and out by dragging or the mouse wheel. But I need to get the bounds so that I can use this.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * @author Admin
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Point;
    import java.awt.RenderingHints;
    import java.awt.Toolkit;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.event.MouseWheelEvent;
    import java.awt.event.MouseWheelListener;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.NoninvertibleTransformException;
    import java.awt.geom.Point2D;
    import javax.swing.JFrame;
    import javax.swing.JLayeredPane;
    import javax.swing.JPanel;
    public class ZoomDemo extends JPanel {
    AffineTransform tx = new AffineTransform();
    String imagePath = "D:/Documents and Settings/Admin/Belgelerim/tsrm/resim.jpg";
    Image image = Toolkit.getDefaultToolkit().getImage(imagePath);
    int width = image.getWidth(this);
    int height = image.getHeight(this);
    int scrwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
    int scrheight = Toolkit.getDefaultToolkit().getScreenSize().height;
    double zoomfac = 1.0;
    int xAdj;
    int yAdj;
    int prevY;
    double scale = 1.0;
    Point pt;
    public static int x;
    public static int y;
    public static int w;
    public static int h;
    public ZoomDemo() {
    this.addMouseWheelListener(new ZoomHandler());
    this.addMouseListener(new ZoomHandler());
    this.addMouseMotionListener(new ZoomHandler());
      repaint();
    @Override
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.drawImage(image, tx, this);
    // x =    (int) g2.getClipBounds().getX();
    // y=     (int) g2.getClipBounds().getY();
    // w=     (int) g2.getClipBounds().getWidth();
    // h=     (int) g2.getClipBounds().getHeight();
    // System.out.println(x+" "+y+" "+w+" "+h);
    //  public int getRectx(){
    //    return x;
    //public int getRecty(){
    //    return y;
    //public int getRectw(){
    //    return w;
    //public int getRecth(){
    //    return h;
    private class ZoomHandler implements MouseWheelListener,MouseListener, MouseMotionListener {
    public void mousePressed(MouseEvent e){
        System.out.println("Mouse Pressed");
    xAdj = e.getX();
    yAdj = e.getY();
    prevY = getY();
    public void mouseDragged(MouseEvent e){
           System.out.println("Mouse Dragged");
    boolean zoomed = false;
    if(e.getY()<prevY){
         zoomfac = zoomfac + 0.1;
         prevY = e.getY();
         zoomed = true;
    else if(e.getY()>prevY){
         zoomfac = zoomfac - 0.1;
         prevY = e.getY();
         zoomed = true;
       scale = zoomfac;
    Point2D p1 = new Point((int)xAdj-(width/2),(int)yAdj-(height/2));
    Point2D p2 = null;
    try {
    p2 = tx.inverseTransform(p1, null);
    } catch (NoninvertibleTransformException ex) {
    // should not get here
    ex.printStackTrace();
    return;
    tx.setToIdentity();
    tx.translate(p1.getX(), p1.getY());
    tx.scale(scale, scale);
    tx.translate(-p2.getX(), -p2.getY());
    tx.transform(p1, p2);
    ZoomDemo.this.revalidate();
    ZoomDemo.this.repaint();
    public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
    Point2D p1 = e.getPoint();
    Point2D p2 = null;
    try {
    p2 = tx.inverseTransform(p1, null);
    } catch (NoninvertibleTransformException ex) {
    // should not get here
    ex.printStackTrace();
    return;
    scale -= (0.1 * e.getWheelRotation());
    scale = Math.max(0.1, scale);
    tx.setToIdentity();
    tx.translate(p1.getX(), p1.getY());
    tx.scale(scale, scale);
    tx.translate(-p2.getX(), -p2.getY());
    ZoomDemo.this.revalidate();
    ZoomDemo.this.repaint();
            public void mouseClicked(MouseEvent e) {
                //throw new UnsupportedOperationException("Not supported yet.");
            public void mouseReleased(MouseEvent e) {
                //throw new UnsupportedOperationException("Not supported yet.");
            public void mouseEntered(MouseEvent e) {
               // throw new UnsupportedOperationException("Not supported yet.");
            public void mouseExited(MouseEvent e) {
               // throw new UnsupportedOperationException("Not supported yet.");
            public void mouseMoved(MouseEvent e) {
               // throw new UnsupportedOperationException("Not supported yet.");
    public static void main(String[] args) {
    //SwingUtilities.invokeLater(new ZoomDemo());
    int scrwidth = Toolkit.getDefaultToolkit().getScreenSize().width;
    int scrheight = Toolkit.getDefaultToolkit().getScreenSize().height;
    JFrame f = new JFrame("Zoom");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(scrwidth , scrheight);
    //JLayeredPane lp = new JLayeredPane();
    //f.add(lp);
    ZoomDemo zd = new ZoomDemo();
    zd.getBounds();
    f.add(zd);
    //int x = (int) zd.getX();
    //int y = (int) zd.getY();
    //int w = (int) zd.getWidth();
    //int h = (int) zd.getHeight();
    //System.out.println(x+" "+y+" "+w+" "+h);
    //zd.setBounds(x ,y ,w ,h );
    //lp.add(zd, JLayeredPane.DEFAULT_LAYER);
    //f.setLocationRelativeTo(null);
    f.setVisible(true);
    //lp.setVisible(true);
    //zd.setVisible(true);
    }Edited by: .mnemonic. on May 26, 2009 11:07 PM
    Edited by: .mnemonic. on May 27, 2009 11:00 AM

    You'll need a stable point in the component to track and orient to the scaling transform(s).
    From this you can construct whatever you need in the way of image location and size.
    Let's try a center&#8211;of&#8211;image tracking point:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class ZD extends JPanel {
        BufferedImage image;
        Point center;
        AffineTransform at = new AffineTransform();
        Point2D.Double origin = new Point2D.Double(0,0);
        public ZD(BufferedImage image) {
            this.image = image;
            center = new Point(image.getWidth()/2, image.getHeight()/2);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            g2.drawRenderedImage(image, at);
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(origin.x-1.5, origin.y-1.5, 4, 4));
            g2.setPaint(Color.blue);
            g2.fill(new Ellipse2D.Double(center.x-1.5, center.y-1.5, 4, 4));
        private void setTransform(double scale) {
            // keep image centered over Point "center"
            double x = center.x - scale*image.getWidth()/2;
            double y = center.y - scale*image.getHeight()/2;
            origin.setLocation(x, y);
            at.setToTranslation(x, y);
            at.scale(scale, scale);
        public static void main(String[] args) throws java.io.IOException {
            java.net.URL url = ZD.class.getResource("images/hawk.jpg");
            BufferedImage image = javax.imageio.ImageIO.read(url);
            ZD test = new ZD(image);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.setSize(500,500);
            f.setLocation(100,100);
            f.setVisible(true);
            test.addMouseListener(test.mia);
            test.addMouseMotionListener(test.mia);
        /** MouseAdapter okay in j2se 1.6+ */
        private MouseInputAdapter mia = new MouseInputAdapter() {
            final double SCALE_INC = 0.05;
            final int SCALE_STEP = 20;
            double scale = 1.0;
            double lastStep;
            public void mousePressed(MouseEvent e) {
                Point p = e.getPoint();
                center.setLocation(p);
                //System.out.printf("center = [%3d, %3d]%n", p.x, p.y);
                setTransform(scale);
                repaint();
            public void mouseDragged(MouseEvent e) {
                // scale up/down with relative vertical motion
                int step = (e.getY() - center.y)/SCALE_STEP;
                if(step != lastStep) {
                    scale += SCALE_INC*((step < lastStep) ? -1 : 1);
                    //System.out.printf("step = %3d  scale = %.3f%n", step, scale);
                    setTransform(scale);
                    lastStep = step;
                    repaint();
    }

  • Bounding box around rollover images

    Can anyone tell me how to remove a visible bounding box on
    rollover images. The bounding box does not appear until you click
    on the rollover image. This does not show up in Safari but does
    show in IE and Firefox. Any help is appreciated.

    > I have
    > one other question, do you know why some browsers are
    set for seeing this
    > bounding box and others (like Safari) are not?
    No, I have no idea. But I realize, I may have given you a bum
    steer. What
    I was describing was the a:focus functionality which happens
    BEFORE you
    click. What you are asking about is something that you see
    AFTER clicking,
    right? In that case, try the CSS rule -
    a img { outline:none; }
    and see if that works.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "webimom" <[email protected]> wrote in
    message
    news:gav2ut$qie$[email protected]..
    > Murray, Thanks for the code and for the information, I
    had no idea it
    > could be
    > useful. It just looked odd on my rollover buttons. I am
    a newbie at all
    > this,
    > barely knowing HTML (planning on taking a class) but
    loving Dreamweaver. I
    > have
    > one other question, do you know why some browsers are
    set for seeing this
    > bounding box and others (like Safari) are not?
    >
    > I really appreciate your help and going to take your
    advice and leave it
    > alone.
    >

  • Changing the bounding box size

    When I go to print an image in Photoshop CC, a dialogue box appears and on the left-hand side is the image to be printed. Bordering the image are small diagonal lines which I'm assuming are the bounding box. The distance between the edge of the page varies from side to side and I want to center the photo. I can't see how to do that.
    Thanks.

    The print dialog preview area show basically three areas.  The Paper size the printer is set to and the sizes are displayed with numeric unites. If you see small diagonal lines these are showing the areas the printer can not print on with the current settings.  With different printer setting this area may change for example if the printer support borderless the side non printable may go way but there still be some top and bottom non printable area. The Bottom non printable area may go away if you switch from sheet feed to roll paper feed. Inside the diagonal line is the printable area and inside that a bounding box of the image. If You check scale for media the image will be scaled to fit within the print area.

  • Why can't I see the bounding box for objects on the pasteboard?

    Adobe CC sucks. Why last week was I able to see the bounding box of objects that I had on the pasteboard in InDesign CC, including objects that didn't contain anything yet, and now suddenly this week I can't see them?
    It seems as though every week something inexplicably gets changed around. First Save As had no shortcut, then suddenly the shortcut is back, but it doesn't work.
    Get it together Adobe. I don't want to be paying a subscription for a product that feels as though it's still in Beta mode.

    Hi Steve,
    Yes thanks, I don't think I was clear in what I wrote. I knew that they could be turned back on, but why did I open InDesign this morning to find my workspace/preferences different than how I left them on Friday?
    And I know it isn't a case of my mistakenly turning off the frame edges, because the operator that sits next to me had the exact same thing happen to her copy of InDesign this morning also.
    I understand the requirement to update things, but it really does feel as though I'm using software that is still in testing.

  • Lost the bounding box (scale handles)

    HELP. I have lost the bounding box (scale handles) for only the Rectangle and Rounded Rectangle Tools. I have tried switching the view options on and off with no changes or improvements. How do I reset the presets or preferences. Will this help? Thanks

    Robert,
    There are a few more options.
    As Larry said, the Live Rectangle bug is limited to the MAC versions starting with 10.7 and 10.8, but not 10.9 (Mavericks) or 10.10 (Yosemite). Hopefully, the bug will be fixed soon.
    So a switch to Mavericks or Yosemite with a reinstallation might be the way to solve it here and now.
    To get round it in each case, it is also possible to Expand the Live Rectangles to get normal old fashioned rectangles, or to Pathfinder>Unite, or to use the Scale Tool or the Free Transform Tool.
    A more permanent way round that is to create normal old fashioned rectangles, after running the free script created by Pawel, see this thread with download link:
    https://forums.adobe.com/thread/1587587

  • Cannot resize object with the bounding box.

    I am using Illustrator CS4. When I move my selection tool to the white square on the bounding box for resizing, I am not getting the normal arrows that appear. When I click on the box and move the pointer the entire box and image move. This was working OK until about 5 hours ago.
    Thanks for any help.  BreBro1

    Are u able to see the bounding box ? It might be hidden. Can u please try this
    goto View > Show Bounding Box
    shortcut Crtl + Shift + B
    give it a try if this doesn't work I would suggest u to share a screenshot so I could help you
    good luck.

  • Why can't I select an object from its center?  Direct selecttool will only select bounding box.

    Why can't I select an object from its center?  Direct selecttool will only select bounding box.

    You may have turned on "Object selection by path only" in the "Selection Options".

  • Save Only The Artboard area into AI file

    Hi,
    Is it possible to save only the ARTBoard Area into a new AI document by using JSX.
    for example in the above image I want only the yellow marked drawing ,that is inside the artboard area, to be save in the new document [AI file] by using JSX.
    Thanks

    What you see in the document is what you will see when you save it.
    I recommend saving as a psd then if you really want to you can merge the layer or flatten (merge will leave the background transparent whereas flatten will give you a white backgound if there are any transparent areas in the document)
    (ctrl-e or ctrl-shift-e {windows} cmd-e or cmd-shift-e {Mac})
    Or you can leave the layers alone and create a composite (A new merge layer on top of the other layers)
    (ctrl-shift-alt-e {windows} cmd-shift-opt-e {mac})
    That said not all formats support layers or transparency. An example of that is jpg when you save with that format you will get a single flattened layer that will have a white background anyplace there was transparency.
    To recap:
    1)Always work on a duplicate file when doing destructive work so you can return later and undo what you did.
    2)When ever possible use non-destructive edits such as a composite layer.
    3)If you require layers or transparency it is required that you use a format that supports them like tiff or psd
    4)Use jpg as a file for sharing and never as the master file. Because the format is destructive and throws out data each time you open and save it.

Maybe you are looking for

  • Tiger Installation Problems, Monitor Doesn't Have Picture

    *Originally Posted in Tiger Support Discussions but no response.* Hi every1, I'm having problems as well trying to install Tiger on my power mac G3. I did the software exchange thing where I got CD's in place of the DVD. During installation,I restart

  • USING TWO AIRPORT EXTREMES (802.11N) INTERNET IS VERY SLOW

    I live in a 5000sq ranch in arizona and have our internet set up in one end of the house. We have an airport extreme 802.11n and it wasnt putting out a good signal to the other end of the house so we got another airport extreme and airport express to

  • How to define configurable Properties in WAS - CE 7.1 ??

    Hi, You can visit NetWeaver Administrator Web Page of your server: [http://<server>:<port>/nwa|http://<server>:<port>/nwa] You must have Admin rights to do so. And you can see/edit properties from various tabs and not under single tab. Reason: All th

  • After ios 7  problems with cloud

    Iphone keep asking me to agree with I cloud  terms and conditions but I can not find where it is and how i agree on ios7 I press to go to terms and conditions they send me to Icloud account but there is no terms to agree there What i need to do to st

  • IPhoto- Can it print dates on photos?

    I would like to print dates on photos. Is this possible with iPhoto '08 Version 7.1.5 (378)?