Creating Images

Im trying to make a double buffered panel.
Ive used the Image x = createImage(intx,inty); method of constructing the image, when i get the graphics to write to the image I always get an execption. the code is as follows
import java.awt.*;
public class BufferedPanel extends Panel {
     Graphics BufferedGraphics ,MainGraphics;
     Image BackBuffer;
     int Xsize, Ysize;
     public BufferedPanel()
          super();
          Xsize = this.getX();
          Ysize = this.getY();
          this.setVisible(true);
          BackBuffer = createImage(Xsize,Ysize);
          System.out.println(BackBuffer);
          //always prints null
          BufferedGraphics = BackBuffer.getGraphics();
          //null pointer execption
          MainGraphics = this.getGraphics();
     private void resetBuffer(){
     Xsize=this.getX();
     Ysize=this.getY();
     // clean up the previous image
     if(BufferedGraphics!=null){
     BufferedGraphics.dispose();
     BufferedGraphics=null;
     if(BackBuffer!=null){
     BackBuffer.flush();
     BackBuffer=null;
     System.gc();
     // create the new image with the size of the panel
     BackBuffer=createImage(Xsize,Ysize);
     BufferedGraphics=BackBuffer.getGraphics();
     public void paint()
          resetBuffer();
          if(BufferedGraphics!=null){
     //this clears the offscreen image, not the onscreen one
     BufferedGraphics.clearRect(0,0,Xsize,Ysize);
     //calls the paintbuffer method with
     //the offscreen graphics as a param
     Draw(BufferedGraphics);
     //we finaly paint the offscreen image onto the onscreen image
     MainGraphics.drawImage(BackBuffer,0,0,this);
     private void Draw(Graphics g){          
thanks for the help

Hello,
make sure your BufferPanel is actually visible "before" your call to createImage().
(T)

Similar Messages

  • Unable to create image buffer after RAM preview

    Running into an odd and frustrating error. Built a comp using the new Ray-traced 3D renderer and now I'm regretting being an early adopter big time with all the problems I've been encountering with it. The latest comes whenever I do a longer RAM preview in an attempt to watch the whole duration of my comp. It will get to about 170 frames or so, at which point I've interrupted by pressing spacebar because I don't need to see all the way to the end of my work area (around 220 frames). It'll play the RAM preview back fine, and even loop it, but as soon as I stop playback, I get this error message: "After Effects warning: Unable to create image buffer." There's only one button: "okay" and as soon as I click it the same error pops up again and it will never go away, forcing me to close AE from the task manager. I've taken to saving before every RAM preview like I used to do with Flash before previewing my buggy swfs for fear I'll lose all my work after previewing. Any ideas about what might be causing this?
    Some more details about my comp:
    1920x1080 @ 29.97
    Ray-traced 3D
    About 70 3D layers (I'm guessing this is my downfall - new renderer not designed for this many layers?)
    Running Windows 7 Professional
    i7 2600K
    32GB RAM
    2x GTX 570 video cards running latest driver (301.42, CUDA 4.2.1)
    508GB free on my 2TB internal drive where the project and cache lives
    From my GPU info window in case it's useful:
    Fast Draft:
    Available
    Texture Memory:
    600.00 MB
    Ray-tracing:
    GPU
    OpenGL
    Vendor:
    NVIDIA Corporation
    Device:
    GeForce GTX 570/PCIe/SSE2
    Version:
    3.0.0
    Total Memory:
    1.20 GB
    Shader Model:
    4.0 or later
    CUDA
    Driver Version:
    4.2
    Devices:
    2 (GeForce GTX 570, GeForce GTX 570)
    Current Usable Memory:
    1.04 GB (at application launch)
    Maximum Usable Memory:
    1.25 GB

    Yeah, some buffer is very likely not flushing when you interrupt the preview and then there is no more memory on the graphics hardware. Consider setting the work area and your preview options to use only the work area. if it finishes the preview "correctly", it may not suffer the issue. Beyond that - raytracing doesn't/ shouldn't care about the number of items. The math is such, that it makes no difference whether you render a million polygons or just one. Of course there are still limitations due to the GPU dependency, but I doubt you ever truly exhaust the cards' geometry buffers. Compared to pixel data that is a small amount...
    Mylenium

  • How to create Image as Custom Property Type used in Configurable Web Part?

    I wanted to create custom configurable web part property for Image.
    Example - the screenshot of Image property used in Image web part is shown below:
    My goal is to create as many images as possible in custom configurable web part.
    I tried to write the code:
    [WebBrowsable(true),
    WebDisplayName("Example Photo"),
    WebDescription("Example Photo of the user"),
    Category("Custom User Profile"),
    Personalizable(PersonalizationScope.Shared)]
    public Image ExampleUserPhoto { get; set; }
    However, the result does not display Image configurable web part property.
    I wonder why the data type Image does not cause the custom web part to have Image configurable web part property.
    Other data types such as Boolean, Enum, Integer, String and DateTime can be used.
    How can I create Image as Custom Property Type used in Configurable Web Part?

    I have examined that context node __00 has been enhanced,and  has a class name  z___00. But  when I created a new attirubute by right click " Attributes" with wizard under context node __00.There is still  a error message "view is not enhaced or copied with wizard".
    But  when  I created a method  "getvaliation "  in the class of context node zcl__00, the attribute  'valiation' automatically created(at the same time the method "getvaliation' automatically  created for the attribute 'valiation') and I need not to create attibute 'validation' by wizard .  It seemed as if the problem is resloved. But when I make test for it in web ui .There is a runtime erro message.
    Do I need to make some configurations in  the business object layer  for the checkbox? but  the checkbox is only used as a flag  to decide whether a backgoud job is needed to be executed.
    Edited by: samhuman on Jun 22, 2010 10:31 AM

  • Disk Utility fails to create image from double layer DVD

    I burned a double-layer DVD using iDVD. It plays fine on the mac and on set-top DVD players. However, when I try to create an image of the DVD using Disk Utility, I get "Can't create image 'name.cdr' (input/output error)". I've tried re-burning the original disk, but it gets the same error when trying to create an image. I've also tried each of the image types, all with the same result.

    I was having similar problems, although I don't think my issues was related to a double-layer DVD. What worked for me was selecting File > New > Disk Image from Folder. Select the DVD in the file open/save dialog with the same options you used before (e.g., DVD/CD master, etc).
    HTH
    - Dave

  • Error creating //image file

    I don't know if anyone out there is still getting this error message, but I have found that by simply removing the "/" in the FTP dialog box under "host directory" your problem is solved. Apparently Muse adds the "/" and if you have one in the dialog box, there will be two instead of one causing the error. I am not a tech and just discovered this fix. Hope it helps!

    Hi Hollie, and welcome to the forums!
    Have you created images before successfully?
    Is this to/on your boot drive, or an external drive?
    Have you done any Disk/OS maintenance lately?
    We might see if there are some big temp files left or such...
    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is now free, and likely the best/easiest...
    http://www.omnigroup.com/applications/omnidisksweeper/
    WhatSize...
    http://www.macupdate.com/info.php/id/13006/
    Disk Inventory X...
    http://www.derlien.com/
    GrandPerspective...
    http://grandperspectiv.sourceforge.net/

  • Shared Components Images Create Image does not work

    I am using oracle XE on Windows XP.
    Uploading an image for an application does not work.
    Home>Application Builder>Application 105>Shared Components>Images>Create Image
    It goes wrong when I try to upload the image:
    - Iexplorer gives an error 404 after pressing the Upload button.
    - Firefox just gives an empty page.
    When I try to refresh the resulting page (do another post) I get the following error:
    Expecting p_company or wwv_flow_company cookie to contain security group id of application owner.
    Error ERR-7621 Could not determine workspace for application (:) on application accept.

    Hi Dietmar,
    After setting the language to English (USA) [en-us] it works for +- 50 % of the uploads.
    Below is my tracefile.
    Dump file e:\oraclexe\app\oracle\admin\xe\bdump\xe_s001_2340.trc
    Wed Nov 23 19:03:17 2005
    ORACLE V10.2.0.1.0 - Beta vsnsta=1
    vsnsql=14 vsnxtr=3
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
    Windows XP Version V5.1 Service Pack 2
    CPU : 2 - type 586
    Process Affinity : 0x00000000
    Memory (Avail/Total): Ph:267M/1014M, Ph+PgF:1431M/2444M, VA:1578M/2047M
    Instance name: xe
    Redo thread mounted by this instance: 1
    Oracle process number: 15
    Windows thread id: 2340, image: ORACLE.EXE (S001)
    ------ cut ------
    *** 2005-11-23 19:50:44.718
    *** ACTION NAME:() 2005-11-23 19:50:44.718
    *** MODULE NAME:() 2005-11-23 19:50:44.718
    *** CLIENT ID:() 2005-11-23 19:50:44.718
    *** SESSION ID:(26.18) 2005-11-23 19:50:44.718
    Embedded PL/SQL Gateway: /htmldb/wwv_flow.accept HTTP-404 ORA-01846: not a valid day of the week
    *** SESSION ID:(27.19) 2005-11-23 19:50:51.937
    Embedded PL/SQL Gateway: /htmldb/wwv_flow.accept HTTP-404 ORA-01846: not a valid day of the week
    *** 2005-11-23 19:50:59.078
    *** SERVICE NAME:(SYS$USERS) 2005-11-23 19:50:59.078
    *** SESSION ID:(27.21) 2005-11-23 19:50:59.078
    Embedded PL/SQL Gateway: Unknown attribute 3
    Embedded PL/SQL Gateway: Unknown attribute 3
    Strange error... there is nothing in my form that is related to dates...
    Kind regards,
    Pieter

  • Trying to create images to be used in my game

    Here's my situation. I have 3 main parts of the game.
    0 - in play
    1 - level up
    2 - buy screen
    each one has its own basic images/text that don't change. I want to create Images with all that background stuff already on it to improve the efficiency of the drawing. So here's what I tried:
    private Image          back, shipImage, ship2Image;
    private Graphics     backG;
    private Graphics2D     g2d;
    private Image[]          gameStateBackGround = new Image[3];
    private Graphics2D[]     gameStateGraphics2D = new Graphics2D[3];
    //In init.  I know these graphics objects work because this is what I
    //started with but now I'm wanting to improve
    back = createImage(mapWidth,mapHeight);
    backG = back.getGraphics();
    g2d = (Graphics2D) backG;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    shipImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("ship.png")).getScaledInstance(20, 30, Image.SCALE_SMOOTH);
    ship2Image = Toolkit.getDefaultToolkit().getImage(getClass().getResource("ship2.png")).getScaledInstance(55, 35, Image.SCALE_SMOOTH);
    //In a method called in init() to create the Images I desribed
    gameStateBackGround[in_play] = createImage(mapWidth,mapHeight);
    drawStarField(gameStateBackGround[in_play].getGraphics());
    gameStateGraphics2D[in_play] = (Graphics2D) gameStateBackGround[in_play].getGraphics();
    starBase.draw(gameStateGraphics2D[in_play]);
    //In my draw method
    gameStateBackGround[in_play] = createImage(mapWidth,mapHeight);
    drawStarField(gameStateBackGround[in_play].getGraphics());
    gameStateGraphics2D[in_play] = (Graphics2D) gameStateBackGround[in_play].getGraphics();
    starBase.draw(gameStateGraphics2D[in_play]);now before I just had that main stuff drawing to the graphics objects used for the whole applet, and it worked fine. What I want is to pre-draw them, and just slap that whole single image of the constant stuff to my area of gameStateBackGround[]. Am I off to the right start?
    Now my drawStarField method asks for a Graphics object, and that draws, and that actually shows. Now for the stuff that's using Graphics2D objects, that is NOT showing. So I think where my main problem is is in creating the Graphics2D objects correctly. This whole concept I'm using for creating objects may be horrid, but hey, that's where you guys come in :) Tell me where I've screwed up hehe. Thanks for the help!          

    oops I screwed up. After:
    //In my draw method
    [/code
    comesbackG.drawImage(gameStateBackGround[gameState], 0, 0, this);

  • Using Cap6, need to create menu screen that allows user to click a button, branch to other screens, and return to main menu. When returning to the main screen the button that was clicked will be grayed out or inactive.  How do I do this?  I created image

    I am trying to emulate a piece of equipment.  I need the user to be able to click on specific buttons that will take the user to another screen(s).  After viewing those screens the user will be directed back to the main screen where the user would know which buttons had been pressed and which still needed to be pressed.  I create image buttons with the 3 states - that worked except when the user returns the slide is reset and so the user does not see the 3rd state of the button.  How can I get that 3rd state to stay after user returns to the main screen? 

    Hi Elizabeth,
    Since I just did this morning what you are currently attempting to do, I thought I'd share my method.  I must provide a disclaimer and tell you that I am not an expert in Captivate advanced actions--like you, I am still figuring them out.  However, I am happy to share here anything I have learned thus far.
    First, here is what my initial slide looks like (see interaction slide below).  I created all of the icons (including the 'grayed out' icon on the second screenshot) in a few minutes using Adobe Illustrator. The icons have been imported as custom multi-state buttons so that I could have the desired effect when the user hovers over the image--the yellow 'explore' flag appears only when the mouse is over the icon. When the learner click either image, they are sent to the corresponding slide.  Once both slides are viewed, a 'continue' button will appear at the base of the screen (something I've not figured out--I sent an email to Lieve begging for some guidance). 
    The initial slide (interaction slide):
    Second, here is a depiction of what happens when the learner returns to the interactive slide from the content slide (see image below):  Once the learner visits the 'Battery Content' slide and then returns to the interaction slide, the images have changed.  The multi-state button is hidden (through the advanced action), the replacement image (the image with the completed banner over it) is shown, and a hidden click box to allow the user to return to the previously visited page (just in case they desire to do that) is "shown" to allow navigation since the button is no longer there (because it is magically hidden).
    Content Slide 1:
    Remember, there may be an easier way to do this in Captivate.  I am using Cp6 for this module.
    1. I created two user variables as follows
    Name: v_batteryExplore
    Value: 0
    Name: v_fuelExplore
    Value: 0
    2. I created an advanced action for each as shown below (showing only one--duplicate the first and change the names to match the content):
    Credit: I learned these steps from @Lilibiri and Dr. Pooja Jaisingh!
    I have also noticed that it matters where the buttons are located on the timeline.  It seems best to have buttons above all other content.  Not sure why, but I have had images not appear when I have not done this.
    And the last step you do not want to forget; you need to remember to tell Captivate to use the action.
    As a final note, remember that the elements you do not want to appear on the initial screen must not be initially visible.  Make sure to set them to invisible by removing the checkmark in the 'Visible in output' box located next to the button name.  In my case, the image of the completed battery and the invisible button to allow a revisit of content was initially hidden.  Here is a final screenshot of my timeline for this interaction.  I hope this information helps you!

  • What is the best compatible graphics software to create images in ibook author?

    What is the best compatible graphics software to create images in ibook author?

    What you choose may depend on your budget, skills, etc.
    Preview comes with OS X.
    GifConverter and Pixelmator are in the (Mac) App Store and work well.

  • SIU fails to create images

    Using SIU 10.6.7 on a machine updated to 10.6.8, trying to create a NetInstall image of a 10.6.3 Retail disc. SIU fails consistently, even after a reinstall of the server admin tools.
    This is what I get from the console log:
    12/8/11 1:12:37 PM          System Image Utility[154]          Assistant - Selected source:"NetInstall of OS X 10.6.3 Installer".
    12/8/11 1:12:58 PM          [0x0-0x13013].com.apple.server.SystemImageUtility[154]          objc[154]: Class SIUDiskUtility is implemented in both /Applications/Server/System Image Utility.app/Contents/MacOS/System Image Utility and /Applications/Server/System Image Utility.app/Contents/Library/Automator/Define Image Source.action/Contents/MacOS/Define Image Source. One of the two will be used. Which one is undefined.
    12/8/11 1:13:02 PM          System Image Utility[154]          Something didn't really work out here...
    12/8/11 1:13:02 PM          System Image Utility[154]          Failed to create image from script createNetInstall.sh.

    Try setting the debug level to verbose in the SIU preferences. This should give more information about the failure in the run log for the image build.
    You should also be looking for the SIU logs instead of the console. They're in ~/Library/Logs (you access them through Console.app as well.)
    I've never actually seen the "Something didn't really work out here..." message occur. It means that SIU failed to communicate with its helper tool that builds the images.

  • Create images with dynamic width from 3 images each (left/center/right-part)

    Hello,
    i want to employ a script to create images of dynamic width for me. The whole process shall base on different sized sets of images, which contain a left-image, a right-image and a center-image. The desired width for the different cases shall be reached by duplicating the center-image between the two outer images and placing those images next to each other until the image extends to desired width.
    The layers importet into Photoshop shall be importet as smart-layers (which i already solved).
    Has anyone done something similar already and could give me some useful hints on that issue ?
    I have come up to this until now:
    #target Photoshop
    // =========================== Opens a new document and asks for dimensions ============================
    var myLayerset = File.openDialog ("Select the set of images you want to use!", "*.png",true)
    var myName = prompt("How do you want to call the document?"); // askes for document name
    var width =  prompt("Please insert width for the output here!", ""); // askes for desired width
    var height = prompt("Please insert height for the output here!", ""); //askes for desired height
    var docName = myName +".psd"
    var idMk = charIDToTypeID( "Mk  " );
        var desc3 = new ActionDescriptor();
        var idNw = charIDToTypeID( "Nw  " );
            var desc4 = new ActionDescriptor();
            var idNm = charIDToTypeID( "Nm  " );
            desc4.putString( idNm, """Wunschname""" );
            var idMd = charIDToTypeID( "Md  " );
            var idRGBM = charIDToTypeID( "RGBM" );
            desc4.putClass( idMd, idRGBM );
            var idWdth = charIDToTypeID( "Wdth" );
            var idRlt = charIDToTypeID( "#Rlt" );
            desc4.putUnitDouble( idWdth, idRlt, width );
            var idHght = charIDToTypeID( "Hght" );
            var idRlt = charIDToTypeID( "#Rlt" );
            desc4.putUnitDouble( idHght, idRlt, height );
            var idRslt = charIDToTypeID( "Rslt" );
            var idRsl = charIDToTypeID( "#Rsl" );
            desc4.putUnitDouble( idRslt, idRsl, 72.000000 );
            var idpixelScaleFactor = stringIDToTypeID( "pixelScaleFactor" );
            desc4.putDouble( idpixelScaleFactor, 1.000000 );
            var idFl = charIDToTypeID( "Fl  " );
            var idFl = charIDToTypeID( "Fl  " );
            var idTrns = charIDToTypeID( "Trns" );
            desc4.putEnumerated( idFl, idFl, idTrns );
            var idDpth = charIDToTypeID( "Dpth" );
            desc4.putInteger( idDpth, 8 );
            var idprofile = stringIDToTypeID( "profile" );
            desc4.putString( idprofile, """sRGB IEC61966-2.1""" );
        var idDcmn = charIDToTypeID( "Dcmn" );
        desc3.putObject( idNw, idDcmn, desc4 );
    executeAction( idMk, desc3, DialogModes.NO );
    //==============================================save document================================================
    var idsave = charIDToTypeID( "save" );
        var desc4 = new ActionDescriptor();
        var idAs = charIDToTypeID( "As  " );
            var desc5 = new ActionDescriptor();
            var idmaximizeCompatibility = stringIDToTypeID( "maximizeCompatibility" );
            desc5.putBoolean( idmaximizeCompatibility, true );
        var idPhtthree = charIDToTypeID( "Pht3" );
        desc4.putObject( idAs, idPhtthree, desc5 );
        var idIn = charIDToTypeID( "In  " );
        desc4.putPath( idIn, new File( "C:\\Users\\ target folder goes here" + docName ) );
        var idDocI = charIDToTypeID( "DocI" );
        desc4.putInteger( idDocI, 308 );
        var idsaveStage = stringIDToTypeID( "saveStage" );
        var idsaveStageType = stringIDToTypeID( "saveStageType" );
        var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
        desc4.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
    executeAction( idsave, desc4, DialogModes.NO );
    //========================================================================================================
    for (var i = 0; i < myLayerset.length; i++) {
    if (myLayerset[i] instanceof File && myLayerset[i].hidden == false) {
    // ======================================================= opens selected images as smart objects====================
    var idOpn = charIDToTypeID( "Opn " );
        var desc1 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
       desc1.putPath( idnull, myLayerset[i]);
        var idsmartObject = stringIDToTypeID( "smartObject" );
        desc1.putBoolean( idsmartObject, true );
    executeAction( idOpn, desc1, DialogModes.NO );
    //===================================duplicates opened layer into created document========================================
    var idDplc = charIDToTypeID( "Dplc" );
        var desc144 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref135 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref135.putEnumerated( idLyr, idOrdn, idTrgt );
        desc144.putReference( idnull, ref135 );
        var idT = charIDToTypeID( "T   " );
            var ref136 = new ActionReference();
            var idDcmn = charIDToTypeID( "Dcmn" );
            ref136.putName( idDcmn, docName); 
        desc144.putReference( idT, ref136 );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc144.putInteger( idVrsn, 5 );
    executeAction( idDplc, desc144, DialogModes.NO );
    // ======================================================= close tab without saving ==========
    var idCls = charIDToTypeID( "Cls " );
        var desc156 = new ActionDescriptor();
        var idSvng = charIDToTypeID( "Svng" );
        var idYsN = charIDToTypeID( "YsN " );
        var idN = charIDToTypeID( "N   " );
        desc156.putEnumerated( idSvng, idYsN, idN );
    executeAction( idCls, desc156, DialogModes.NO );

    I adapted a Script somewhat, so you may give this a test.
    But it uses the open file so you would have to adapt it further.
    // arranges the selected jpg, tif, psd in line;
    // gutters may be irregular due to rounding effects;
    // thanks to michael l hale and muppet mark;
    // for mac and CS6;
    // 2014, use it at your own risk;
    #target photoshop
    if (app.documents.length == 0) {
              var myDocument = app.documents.add(UnitValue (300, "mm"), UnitValue (50, "mm"), 300, "new", NewDocumentMode.RGB, DocumentFill.TRANSPARENT)
    else {myDocument = app.activeDocument};
    // set to pixels;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var theArray = [0, 0, myDocument.width, myDocument.height];
    // select files;
    if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.pdf;*.psd', true)}
    else {var theFiles = File.openDialog ("please select exactly three files", getFiles, true)};
    // do the arrangement
    if (theFiles) {placeInLines (myDocument, theFiles, theArray)}
    app.preferences.rulerUnits = originalRulerUnits;
    ////// function to place images in lines //////
    function placeInLines (myDocument, theFiles, theArray) {
    theFiles.sort();
    // fit on screen;
    var idslct = charIDToTypeID( "slct" );
    var desc64 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    var ref44 = new ActionReference();
    var idMn = charIDToTypeID( "Mn  " );
    var idMnIt = charIDToTypeID( "MnIt" );
    var idFtOn = charIDToTypeID( "FtOn" );
    ref44.putEnumerated( idMn, idMnIt, idFtOn );
    desc64.putReference( idnull, ref44 );
    executeAction( idslct, desc64, DialogModes.NO );
    // change pref;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    setToAccelerated();
    app.togglePalettes();
    var check = turnOffRescale ();
    // create the arrangement;
    if (theFiles.length > 0 && theFiles.length == 3) {
    myDocument.activeLayer = myDocument.layers[0];
    // create masked group;
    var theGroup = myDocument.layerSets.add();
    theGroup.name = "arrangement";
    // determine the array’s values;
    var areaWidth = theArray[2] - theArray[0];
    var areaHeight = theArray[3] - theArray[1];
    var theDocResolution = myDocument.resolution;
    var areaRelation = areaHeight / areaWidth;
    // center of placed non-pdf images;
    var centerX = Number(myDocument.width / 2);
    var centerY = Number(myDocument.height / 2);
    // suppress dialogs;
    var theDialogSettings = app.displayDialogs;
    app.displayDialogs = DialogModes.NO;
    var pdfSinglePages = new Array;
    var nonPDFs = new Array;
    var theDimPDFs = new Array;
    var theLength = 0;
    // collect the files’ measurements;
    var theDimensions = new Array;
    var theLengths = new Array;
    // array to collect both files and placed pdf-pages;
    var theseFiles = new Array;
    var theLength = 0;
    // collect the files’ measurements;
    for (var o = 0; o < theFiles.length; o++) {
        var thisFile = theFiles[o];
              theseFiles.push(thisFile);
              var theDim = getDimensions(thisFile);
              theDimensions.push(theDim);
              theRelativeWidth = 100 / theDim[1] * theDim[0];
              theLength = theLength + theRelativeWidth;
    // reset dialogmodes;
    app.displayDialogs = DialogModes.ERROR;
    // if three files;
    if (theseFiles.length == 3) {
    // create the layers;
    var theNumber = 0;
    var theAdded = 0;
    var y = areaHeight / 2;
    // add placed image’s width;
    var thisLineWidth = 0 + theAdded;
    var theLastFactor = Number (Number(myDocument.height) / theDimensions[2][1] * theDimensions[2][2] / theDocResolution * 100);
    var theLastWidth = Math.round(theDimensions[2][0] * theLastFactor / 100 * theDocResolution / theDimensions[2][2]);
    // place the files;
    for (var x = 0; x < 3; x++) {
    var theNumber = x;
    var thisFile = theseFiles[theNumber];
    var theFactor = Number (Number(myDocument.height) / theDimensions[theNumber][1] * theDimensions[theNumber][2] / theDocResolution * 100);
    var theNewWidth = Math.round(theDimensions[theNumber][0] * theFactor / 100 * theDocResolution / theDimensions[theNumber][2]);
    var offsetX = theNewWidth / 2 + thisLineWidth - centerX + theArray[0];
    var offsetY = y - centerY + theArray[1];
    var theLayer = placeScaleFile (thisFile, offsetX, offsetY, theFactor, theFactor);
    myDocument.activeLayer.move(theGroup, ElementPlacement.PLACEATBEGINNING);
    thisLineWidth = thisLineWidth + theNewWidth;
    // duplicate the middle one;
    if (theNumber == 1) {
              while (thisLineWidth < myDocument.width - theLastWidth) {
                        theLayer = duplicateAndOffset (theLayer, theNewWidth, 0);
                        thisLineWidth = thisLineWidth + theNewWidth;
    // reset;
    app.togglePalettes();
    turnOnRescale (check);
    app.preferences.rulerUnits = originalRulerUnits;
    ////// playback to accelerated //////
    function setToAccelerated () {
              var idsetd = charIDToTypeID( "setd" );
              var desc1 = new ActionDescriptor();
              var idnull = charIDToTypeID( "null" );
                        var ref1 = new ActionReference();
                        var idPrpr = charIDToTypeID( "Prpr" );
                        var idPbkO = charIDToTypeID( "PbkO" );
                        ref1.putProperty( idPrpr, idPbkO );
                        var idcapp = charIDToTypeID( "capp" );
                        var idOrdn = charIDToTypeID( "Ordn" );
                        var idTrgt = charIDToTypeID( "Trgt" );
                        ref1.putEnumerated( idcapp, idOrdn, idTrgt );
              desc1.putReference( idnull, ref1 );
              var idT = charIDToTypeID( "T   " );
                        var desc2 = new ActionDescriptor();
                        var idperformance = stringIDToTypeID( "performance" );
                        var idperformance = stringIDToTypeID( "performance" );
                        var idaccelerated = stringIDToTypeID( "accelerated" );
                        desc2.putEnumerated( idperformance, idperformance, idaccelerated );
              var idPbkO = charIDToTypeID( "PbkO" );
              desc1.putObject( idT, idPbkO, desc2 );
              executeAction( idsetd, desc1, DialogModes.NO );
    ////// get psds, tifs and jpgs from files //////
    function getFiles (theFile) {
        if (theFile.name.match(/\.(jpg|tif|psd|pdf|)$/i)) {
            return true
    ////// place //////
    function placeScaleFile (file, xOffset, yOffset, theScale) {
    // =======================================================
    var idPlc = charIDToTypeID( "Plc " );
        var desc5 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
        desc5.putPath( idnull, new File( file ) );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc5.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc6 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( idHrzn, idPxl, xOffset );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( idVrtc, idPxl, yOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc5.putObject( idOfst, idOfst, desc6 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc5.putUnitDouble( idWdth, idPrc, theScale );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc5.putUnitDouble( idHght, idPrc, theScale );
        var idLnkd = charIDToTypeID( "Lnkd" );
        desc5.putBoolean( idLnkd, true );
    executeAction( idPlc, desc5, DialogModes.NO );
    return myDocument.activeLayer;
    ////// open pdf //////
    function openPDF (theImage, x) {
    // define pdfopenoptions;
    var pdfOpenOpts = new PDFOpenOptions;
    pdfOpenOpts.antiAlias = true;
    pdfOpenOpts.bitsPerChannel = BitsPerChannelType.EIGHT;
    pdfOpenOpts.cropPage = CropToType.TRIMBOX;
    pdfOpenOpts.mode = OpenDocumentMode.CMYK;
    pdfOpenOpts.resolution = 10;
    pdfOpenOpts.suppressWarnings = true;
    pdfOpenOpts.usePageNumber  = true;
    // suppress dialogs;
    var theDialogSettings = app.displayDialogs;
    app.displayDialogs = DialogModes.NO;
    pdfOpenOpts.page = x;
    var thePdf = app.open(theImage, pdfOpenOpts);
    thePdf.close(SaveOptions.DONOTSAVECHANGES);
    // reset dialogmodes;
    app.displayDialogs = theDialogSettings;
    ////// turn off preference to scale placed image //////
    function turnOffRescale () {
    // determine if the resize prefernce is on;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var appDesc = executeActionGet(ref);
    var prefDesc = appDesc.getObjectValue(charIDToTypeID( "GnrP" ));
    var theResizePref = prefDesc.getBoolean(stringIDToTypeID( "resizePastePlace" ));
    // turn off resize image during place;
    if (theResizePref == true);{
    // =======================================================
    var idsetd = charIDToTypeID( "setd" );
        var desc12 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref4 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idGnrP = charIDToTypeID( "GnrP" );
            ref4.putProperty( idPrpr, idGnrP );
            var idcapp = charIDToTypeID( "capp" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref4.putEnumerated( idcapp, idOrdn, idTrgt );
        desc12.putReference( idnull, ref4 );
        var idT = charIDToTypeID( "T   " );
            var desc13 = new ActionDescriptor();
            var idresizePastePlace = stringIDToTypeID( "resizePastePlace" );
            desc13.putBoolean( idresizePastePlace, false );
        var idGnrP = charIDToTypeID( "GnrP" );
        desc12.putObject( idT, idGnrP, desc13 );
    executeAction( idsetd, desc12, DialogModes.NO );
    return theResizePref
    ////// turn on preference to scale plced image //////
    function turnOnRescale (check) {
    if (check == true) {
    // =======================================================
    var idsetd = charIDToTypeID( "setd" );
        var desc14 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref5 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idGnrP = charIDToTypeID( "GnrP" );
            ref5.putProperty( idPrpr, idGnrP );
            var idcapp = charIDToTypeID( "capp" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref5.putEnumerated( idcapp, idOrdn, idTrgt );
        desc14.putReference( idnull, ref5 );
        var idT = charIDToTypeID( "T   " );
            var desc15 = new ActionDescriptor();
            var idresizePastePlace = stringIDToTypeID( "resizePastePlace" );
            desc15.putBoolean( idresizePastePlace, true );
        var idGnrP = charIDToTypeID( "GnrP" );
        desc14.putObject( idT, idGnrP, desc15 );
    executeAction( idsetd, desc14, DialogModes.NO );
    ////// convert to so if not one aready //////
    function duplicateAndOffset (theLayer, theXOffset, theYOffset) {
    app.activeDocument.activeLayer = theLayer;
    // =======================================================
    var idcopy = charIDToTypeID( "copy" );
        var desc9 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref5 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref5.putEnumerated( idLyr, idOrdn, idTrgt );
        desc9.putReference( idnull, ref5 );
        var idT = charIDToTypeID( "T   " );
            var desc10 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idRlt = charIDToTypeID( "#Pxl" );
            desc10.putUnitDouble( idHrzn, idRlt, theXOffset );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idRlt = charIDToTypeID( "#Pxl" );
            desc10.putUnitDouble( idVrtc, idRlt, theYOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc9.putObject( idT, idOfst, desc10 );
    executeAction( idcopy, desc9, DialogModes.NO );
    return app.activeDocument.activeLayer
    ////// load pdf as smart object //////
    function transformLayer (layer, percentage, xOffset, yOffset) {
    app.activeDocument.activeLayer = layer;
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc4 = new ActionDescriptor();
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc4.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc5 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc5.putUnitDouble( idHrzn, idPxl, xOffset );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc5.putUnitDouble( idVrtc, idPxl, yOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc4.putObject( idOfst, idOfst, desc5 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc4.putUnitDouble( idWdth, idPrc, percentage );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc4.putUnitDouble( idHght, idPrc, percentage );
        var idLnkd = charIDToTypeID( "Lnkd" );
        desc4.putBoolean( idLnkd, true );
        var idAntA = charIDToTypeID( "AntA" );
        desc4.putBoolean( idAntA, true );
    executeAction( idTrnf, desc4, DialogModes.NO );
    return app.activeDocument.activeLayer
    ////// function to get file’s dimensions, thanks to michael l hale //////
    function getDimensions( file ){
    function divideString (theString) {
              theString = String(theString);
        var a = Number(theString.slice(0, theString.indexOf("\/")));
        var b = Number(theString.slice(theString.indexOf("\/") + 1));
        return (a / b)
    // from a script by michael l hale;
    function loadXMPLibrary(){
         if ( !ExternalObject.AdobeXMPScript ){
              try{
                   ExternalObject.AdobeXMPScript = new ExternalObject
                                                                ('lib:AdobeXMPScript');
              }catch (e){
                   alert( ErrStrs.XMPLIB );
                   return false;
         return true;
    function unloadXMPLibrary(){
       if( ExternalObject.AdobeXMPScript ) {
          try{
             ExternalObject.AdobeXMPScript.unload();
             ExternalObject.AdobeXMPScript = undefined;
          }catch (e){
             alert( ErrStrs.XMPLIB );
    ////// based on a script by muppet mark //////
    function dimensionsShellScript (file) {
              try {
    // getMetaDataMDLS;
    if (File(file) instanceof File && File(file).exists) {
              var shellString = "/usr/bin/mdls ";
              shellString += File(file).fsName;
    //          shellString += File(file).fullName;
              shellString += ' > ~/Documents/StdOut2.txt';
              app.system(shellString);
    // read the file;
    if (File('~/Documents/StdOut2.txt').exists == true) {
        var file = File('~/Documents/StdOut2.txt');
        file.open("r");
        file.encoding= 'BINARY';
        var theText = new String;
        for (var m = 0; m < file.length; m ++) {
                        theText = theText.concat(file.readch());
              file.close();
              theText = theText.split("\n");
    // get the dimensions;
              var dim = new Array;
              for (var m = 0; m < theText.length; m++) {
                        var theLine = theText[m];
                        if (theLine.indexOf("kMDItemPixelWidth") != -1) {dim.push(theLine.match(/[\d\.]+/g).join("") )}
                        if (theLine.indexOf("kMDItemPixelHeight") != -1) {dim.push(theLine.match(/[\d\.]+/g).join("") )}
                        if (theLine.indexOf("kMDItemResolutionWidthDPI") != -1) {dim.push(theLine.match(/[\d\.]+/g).join("") )}
                        if (theLine.indexOf("kMDItemResolutionHeightDPI") != -1) {dim.push(theLine.match(/[\d\.]+/g).join("") )}
    // remove file and hand back;
              File('~/Documents/StdOut2.txt').remove();
    catch (e) {
              if (File('~/Documents/StdOut2.txt').exists == true) {File('~/Documents/StdOut2.txt').remove()};
              return dim
              try{
                        loadXMPLibrary();
                        var xmpf = new XMPFile( file.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ );
                        var xmp = xmpf.getXMP();
                        xmpf.closeFile();
                        var resolutionUnit = xmp.getProperty( XMPConst.NS_TIFF, 'ResolutionUnit', XMPConst.STRING);
                        var resFactor = 1;
                        if (resolutionUnit == 2) {
                                  var resFactor = 1;
                        if (resolutionUnit == 3) {
                                  var resFactor = 2.54;
                        var dim = [xmp.getProperty( XMPConst.NS_EXIF, 'PixelXDimension', XMPConst.STRING),
                        xmp.getProperty( XMPConst.NS_EXIF, 'PixelYDimension', XMPConst.STRING),
                        divideString (xmp.getProperty( XMPConst.NS_TIFF, 'XResolution', XMPConst.STRING)) * resFactor,
                        divideString (xmp.getProperty( XMPConst.NS_TIFF, 'YResolution', XMPConst.STRING)) * resFactor];
                        unloadXMPLibrary();
                        if(dim[0]=="undefined" || dim[1]=="undefined"){
                var dim = undefined;
                var res = undefined;
                var bt = new BridgeTalk;
                bt.target = "bridge";
                var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+file.toSource()+");");
                bt.body = myScript;
                bt.onResult = function( inBT ) {myReturnValue(inBT.body); }
                bt.send(10);
                        function myReturnValue(str){
                                  res = str;
                                  dim = str.split(',');
                        function psRemote(file){
                                  var t= new Thumbnail(file);
                                  return t.core.quickMetadata.width+','+t.core.quickMetadata.height;
        }catch(e){unloadXMPLibrary()};
              if (String(dim[2]).indexOf("\/") != -1) {
                        var a = divideString(dim[2]);
                        var b = divideString(dim[3]);
                        dim = [dim[0], dim[1], a, b]
    // if dimensions are missing as might be the case with some bitmap tiffs for example try a shell-script;
              if (dim[0] == undefined || dim[1] == undefined) {
                        var array = dimensionsShellScript(file);
                        dim = array;
    // if shell-string failed open doc to get measurements;
              if (dim[0] == undefined || dim[1] == undefined) {
                        var thisDoc = app.open (File(file));
    // close ai without saving;
                        if (file.name.slice(-3).match(/\.(ai)$/i)) {
                                  thisDoc.trim(TrimType.TRANSPARENT);
                                  var dim = [thisDoc.width, thisDoc.height, thisDoc.resolution, thisDoc.resolution];
                                  thisDoc.close(SaveOptions.DONOTSAVECHANGES)
                        else {
                                  var dim = [thisDoc.width, thisDoc.height, thisDoc.resolution, thisDoc.resolution];
                                  thisDoc.close(SaveOptions.PROMPTTOSAVECHANGES)
    return dim;

  • CS4-created and CS6-created images

    My images created with CS4 print on my Epson R2880, using CS4, faithfully.  I have the monitor and paper profiles calibrated.  CS6-created images also print faithfully using CS6.  But images created with CS4 when printed using CS6 have an appalling dirty green cast.  How can I get CS6 to print CS6 and CS4 images faithfully?  Help, please.

    My images created with CS4 print on my Epson R2880, using CS4, faithfully.  I have the monitor and paper profiles calibrated.  CS6-created images also print faithfully using CS6.  But images created with CS4 when printed using CS6 have an appalling dirty green cast.  How can I get CS6 to print CS6 and CS4 images faithfully?  Help, please.

  • Creating Image "photography_chris.dmg" Unable to create , resource busy

    I have re-started the mac but to no avail, this appears in the console log. I haven't a clue. Thankyou.
    Creating Image “photography_chris.dmg” Unable to create “photography_chris. Resource busy.
    Have searched google but everyone is is giving complex answers to what should be so lego basic!

    oh for pity's sake, have you ever seen that cartoon with dastardly and mutley (mutley being the dog) in wacky races? Well i feel like that dog right now. All this time I was clicking on NEW image in the disc utilities instead of the drop down menu DISK image - it's actually misleading for non tech guys you know, they really should put NEW image in the dialogue box so that it is PLAINLY obvious to all that there are two very different processes here. Because in the help information it constantly refers to new images and disc images interchangeably....

  • Creating image from text

    Hi guys! I want to write/find a way to create image that contains some text. For example when you sing in to yahoo.com it shows you an immage with text that you should input to prove that you`re registering from the site .. How to do this?

    Hi guys! I want to write/find a way to create image that contains some text. For example when you sing in to yahoo.com it shows you an immage with text that you should input to prove that you`re registering from the site .. How to do this?

  • Newly created Image not listed via REST API

    Hi,
    I have created a image in azure console .Its created successfully and i could see the created image under "Image" tab in console.Also, the image created with the name appending current date, it was not before.But when I am trying to list images by
    using the below REST API its listing images except the newly created images that have the  name appended with current date.
    https://management.core.windows.net/5f2fe4c3-23b3-45c0-a70c-9560b79dcf56/services/images
    header values:
    x-ms-version : 2012-03-01
    Content-Type : application/xml
    Host: management.core.windows.net
    This makes me fail to launch new VM via REST api.I got the response as follows
    <Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>BadRequest</Code><Message>The image vmyffdd-20140605-813455l does not exist.</Message></Error>
    Please look into this.

    hi,
    From the error, your request parameter was incorrect. I guess your image name may be wrong. How did you write your Image name and url? I suggest you don't forget the '.VHD'. Also,if you use the
    VMImageName element which is only available using version 2014-02-01 or higher
    And I suggest you could try this code sample about how to using REST api to create VM :Simple Windows Azure REST API Sample Tool
    Please try it.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • System Image Utility seems stuck in "Create Image" step.

    I'm building a NetRestore image with Snow Leopard 10.6.8 as base OS, but added 3rd party software packages. When I hit the "Run" button, it checkmarked all the steps before "Create Image." So I just left it to run the last step, but it's been running now for three days.
    I didn't add THAT many packages. I checked the Force Quit window today, but SIU is not shown in red saying that it stopped responding. Creating this image shouldn't be taking this long.
    SIU is running in XServe 3,1 with OS 10.6.8, and 24GB RAM.
    Any suggestions?

    I do not believe that's
    The server they have is in english yes.....
    I can not believe!!!
    i will try monday and tell you some thing.
    Brian can you say one more thing
    how do I create a script to insert in the post-install script They have in System Image Utility. "package and post-install script ."
    The file need to be in " .sh "??
    i can put the welcome message appear to select the portuguese language but i need to login in single user and put the;
    /sbin/fsck -fy
    /sbin/mount -uw /
    touch /var/db/.RunLanguageChooserToo
    Shutdown -h now
    And works.
    if i can put this in the installation process i thing it will will work.?
    Thanks again for your help

Maybe you are looking for