Saving an image as PNG to a specific location, and appending the document's existing name.

Hello
  I'm building a very complex action that references several scripts. One of the scripts needs to save the existing canvas as a .png file to a specific directory, and rename the .png with the document's existing name and adding "-SCREEN" to the end. So the name sould be "originalname-SCREEN.png"
  I found a script below that almost kinda works. It can find the directory, but it is cropping the image for some unknown reason. It also does not append the name (I have not looked into how to do that at all yet).
  Is anyone able to figure out how to fix this script, or perhaps lend some insight to how I might go about generating a new script?
  I'm not familiar with JS, but I'm learning. Slowly...
Thank you.
#target photoshop
app.bringToFront();
$.level = 0;
// Globals
Settings = {
  storedPaths: {},
  storedSelections: {},
  scriptName: "Save PR JPG LANDING",
  units: "pixels"
// Main entry point
main();
function main() {
  var formatOptions;
  // Create JPEG save options
  formatOptions = formatJPEG(FormatOptions.OPTIMIZEDBASELINE, "10", "3", MatteType.NONE, true);
  // Save copy of document as
  docSaveAs(formatOptions, "Add After", "-LANDING", "No Change", "Path", "~/Desktop/PR/Landing Page (RGB | 105px W x 108px H | 72ppi)/", "");
// Functions
function docSaveAs(formatOptions, nameChange, nameText, newCase, destType, destRef, storeName) {
  var hasPath, f, name, nameArray, n, ext;
  if (!documents.length) { logErr(arguments, "noOpenDocs"); return; }
  if (!formatOptions) { logErr(arguments, "noFormatOptions"); return; }
  if (nameChange=="Replace" && !nameText) { logErr(arguments, "badNameValue"); return; }
  f = fileGetFolder(destType, destRef);
  if (!f) { logErr(arguments, "noDestFolder"); return; }
  try { activeDocument.path; hasPath=true; } catch(e){ hasPath=false; }
  name = activeDocument.name;
  if (hasPath) {
  nameArray = name.split(".");
  n = nameArray.length-1;
  ext = nameArray[n];
  switch (nameChange) {
  case "Add Before": nameArray[0] = nameText + nameArray[0]; break;
  case "Add After": nameArray[n-1] = nameArray[n-1] + nameText; break;
  case "Replace": nameArray = [nameText, ext]; break;
  name = nameArray.join(".");
  else {
  ext = {"[BMPSaveOptions]":".bmp", "[DCS1_SaveOptions]":".eps", "[DCS2_SaveOptions":".eps",
  "[EPSSaveOptions]":".eps", "[GIFSaveOptions]":".gif", "[JPEGSaveOptions]":".jpg",
  "[PhotoshopSaveOptions]":".psd", "[PICTFileSaveOptions]":".pct", "[PICTResourceSaveOptions":".pct",
  "[PixarSaveOptions]":".pxr", "[PNGSaveOptions]":".png", "[RawSaveOptions]":".raw",
  "[TargaSaveOptions]":".tga", "[TiffSaveOptions]":".tif"}[formatOptions.constructor.toString()]||"";
  switch (nameChange) {
  case "Add Before": name = nameText + name; break;
  case "Add After": name = name + nameText; break;
  case "Replace": name = nameText; break;
  if (!name) { name = "Untitled"; }
  name += ext;
  switch (newCase) {
  case "Lowercase": name = name.toLowerCase(); break;
  case "Uppercase": name = name.toUpperCase(); break;
  try {
  f = new File(f.fullName+"/"+name);
  activeDocument.saveAs(f, formatOptions, true);
  Settings.storedPaths.lastCreated = f.fullName;
  if (storeName) { Settings.storedPaths[storeName] = f.fullName; }
  catch(e) { log(arguments.callee, e); }
function fileAppend(path, data, encoding) {
  var file;
  file = new File(path);
  file.open("a");
  if (typeof(encoding) == "string") {file.encoding = encoding;}
  file.write(data);
  file.close();
function fileGetFolder(srcType, srcRef) {
  var path, f, msg;
  switch (srcType) {
  case "Last Created": path = Settings.storedPaths.lastCreated; break;
  case "Path": path = srcRef; break;
  case "Named Path": path = Settings.storedPaths[srcRef.toLowerCase()]; break;
  if (!path) {
  msg = "Select a folder:";
  if (Settings.lastFolderPath) { f = new Folder(Settings.lastFolderPath).selectDlg(msg); }
  else { f = Folder.selectDialog(msg); }
  if (f&&f.exists) { Settings.lastFolderPath = f.fsName.split("\\").join("/")+"/"; }
  else { f = new Folder(path); }
  if (!f||!f.exists) { logErr(arguments, "noFileSystemPath"); return; }
  return f;
function fileWrite(path, data, encoding) {
  var file;
  file = new File(path);
  if (file.exists) {file.remove();}
  file.open("e");
  if (typeof(encoding) == "string") {file.encoding = encoding;}
  file.write(data);
  file.close();
function formatJPEG(format, quality, scans, matte, embed) {
  var result = new JPEGSaveOptions();
  try {
  result.formatOptions = format;
  result.quality = parseInt(quality);
  result.scans = parseInt(scans);
  result.matte = matte;
  result.embedColorProfile = embed;
  catch(e) { log(arguments.callee, e); }
  return result;
function log(v, err, msg) {
  // Initialization
  if (!Settings.debug) {
  var pathArray, date, str;
  Settings.debug = {
  delim:String.fromCharCode(13, 10),
  path: Folder.userData+ "/Script Builder Files/" +Settings.scriptName+ " - Log.txt",
  text:""
  date = new Date();
  str = "Begin debug log: " + date.toLocaleString() +Settings.debug.delim;
  str += "------------------------------------------------------------" +Settings.debug.delim;
  fileWrite(Settings.debug.path, str);
  // Error logging
  if (typeof v == "function") {
  v = "Error in " +v.name+ "(): ";
  if (err && msg) { v += msg + " " + err.message; }
  else if (err) { v += err.message; }
  else if (msg) { v += msg; }
  else { v = v.substring(0, v.length-2) + "."; }
  // Normal message logging
  else {
  if (typeof v != "string") {
  if (v == undefined) {v = "undefined";}
  else {v = v.toString();}
  if (Settings.debug.path) { fileAppend(Settings.debug.path, v + Settings.debug.delim); }
function logErr(src, id) {
  var err = {
  badChannelValue: "Invalid channel number entered.",
  badColorValue: "Invalid color value entered.",
  badDocDimsValue: "Invalid document dimensions entered.",
  badExportValues: "Invalid file path or file name value supplied for export.",
  badNameValue: "Invalid name value supplied.",
  badNumberValue: "Invalid number value supplied.",
  badPathName: "Path name supplied is not unique.",
  badRefEdgeOuput: "Output method cannot be used when decontaminating colors.",
  badSubdivValue: "Subdivisions value must be an integer between 1 and 100.",
  badTestValue: "Invalid comparison value supplied.",
  fileError: "Could not read file.",
  fileExists: "A file of the same name already exists in the chosen location.",
  flatImagesOnly: "This function only works on flattened images.",
  layerDataError: "An error occurred while reading the layer settings.",
  logNotEnabled: "Log must be enabled in order to assign file path.",
  multiLayerOnly: "More than one layer must be selected.",
  noClipImageData: "No image data on clipboard.",
  noDocFile: "Document has never been saved.",
  noActionName: "No action name specified.",
  noActionSetName: "No action set name specified.",
  noBkgdLayer: "There is no background layer.",
  noDestFolder: "Destination folder not defined.",
  noFile: "File does not exist at the specified location.",
  noFileSystemPath: "No file or folder path was chosen.",
  noFilterImg: "Image file does not exist, or none was selected.",
  noFilterMask: "Layer has no filter mask.",
  noFolder: "Folder does not exist at the specified location.",
  noFormatOptions: "The \"formatOptions\" parameter is not defined.",
  noHTMLExporter: "The \"htmlExporter\" object does not exist or is not valid.",
  noLayerArtwork: "Layer has no image data.",
  noLayerComps: "Document has no layer comps.",
  noLayerFX: "Layer has no effects.",
  noLayerMask: "Layer has no layer mask.",
  noLogTextFile: "Log file path should point to a text file.",
  noLogFile: "Log file path does not point to a file.",
  noNameValue: "No new name entered.",
  noOpenDocs: "There are no documents open.",
  noQuicktime: "File format requires QuickTime.",
  noSelectedPath: "There is no path selected.",
  noSelection: "There is no selection.",
  noSelectionMod: "There is no selection to modify.",
  noTextExporter: "The \"textExporter\" object does not exist or is not valid.",
  noVectorMask: "Layer has no vector mask.",
  noWorkPath: "Document has no work path.",
  singleLayerOnly: "Only one layer should be selected.",
  wrongLayerKind: "Selected layer is the wrong kind for the requested action."
  }[id];
  if (err) { log(src.callee, null, err); }

Go to  http://russellbrown.com/scripts.html
download http://russellbrown.com/images/tips_downloads/Services_Installer_2.3.1.zip
extract the "Services_Installer_2.3.1.zip"  do not install the extracted files instead find "Services_Installer_2.3.1.zxp" in the extracted files. This is also a zip file extract the files in it. You may need the reneme it to "Services_Installer_2.3.1.zip" first.  In the extracted files find:
"Image Processor Pro.jsx" and "Image Processor Pro.xml" copy these to Photoshop's Presets\Scripts folder. The "Image Processor Pro: script written by Ross Huitt, [email protected] X use to contribute here but is feed up with Adobe has left. For Adobe does not fix the bugs that have been reported  in Photoshop scripting support. 
However he will continue to support the "Image Processor Pro" script for some time.  Once installed you will find it in  Photoshop's menu File>Automate>Image Processor Pro... . This script is very powerful and configurable and is a Photoshop Plug-in that Action support so not only can use use your actions in its processing you can record its used in actions to bypass its dialog. When the action's Image Processor Pro step is played the recorded dialog setting will be used and  the script will bypass displaying its dialog.
The Script has all the options you need to save PNG files with the original document name with custom text added.  You may be able to do what you want by just recording some simple actions and have the Image Processor Pro script include your actions as part of its processing.

Similar Messages

  • I saved my document as only .doc but not as a pages file and now I cannot edit anything and half the document looks incredibly screwed up, how did this happen?

    I forgot to save the pages file, I do back up on time machine could a temporary file be in there somewhere? It was a 30+ page custom designed presentatiion that took me two weeks. i cannot believe I only saved it as PDF and .doc! My current theory is that I can only edit the document in pages as a pages file since that is what I had been doing. Please help if anyone has had this problem before or know how I can recover that screen I was working with a few days ago before I saved as a Word doc!!

    Despite what Apple and its employees say Pages is not a 100% replacement for Word.
    Pages files exported to .doc will have minor to major differences.
    You should always have a Pages version. Exporting is only so non Mac and non Pages users may read it, and even there you should use .pdf to keep its appearance as close as possible to the original.
    It sounds like you used a lot of Pages' features which turned out to not have Word equivalents.
    Peter

  • Convert images from 24 bit RGB to 8bit and get the best colors

    Hi,
    I use this to do the conversion:
    BufferedImage img2 = new BufferedImage(img1.getWidth(), img1.getHeight(), BufferedImage.TYPE_BYTE_INDEXED);
    ColorSpace colorSpace = img2.getColorModel().getColorSpace();
    ColorConvertOp convertOp = new ColorConvertOp(colorSpace, null);
    convertOp.filter(img1, img2);
    But the colors from img2 does not match with those from img1.
    I guest that it uses a default 256 colors, instead of extracting colors from original images.
    I read about a intermediate conversion to CS_CIEXYZ color space and then to an output colorspace, but i don't now how to code it.
    Clould provide an example of how to do this?
    Many thanks for any help, and duke dollars for the best of them,
    Eugen

    I read about a intermediate conversion to CS_CIEXYZ
    color space and then to an output colorspace, but i
    don't now how to code it.I don't think that's going to help, because I bet your original ColorSpace is sRGB and so will be the ColorSpace of the IndexColorModel.
    1. You are right, the colors used with TYPE_BYTE_INDEXED are default colors. Here is a snippet from the source code:
    // Create a 6x6x6 color cube
    int[] cmap = new int[256];
    int i=0;
    for (int r=0; r < 256; r += 51) {
        for (int g=0; g < 256; g += 51) {
            for (int b=0; b < 256; b += 51) {
                cmap[i++] = (r<<16)|(g<<8)|b;
    // And populate the rest of the cmap with gray values
    int grayIncr = 256/(256-i);
    // The gray ramp will be between 18 and 252
    int gray = grayIncr*3;
    for (; i < 256; i++) {
        cmap[i] = (gray<<16)|(gray<<8)|gray;
        gray += grayIncr;
    colorModel = new IndexColorModel(8, 256, cmap, 0, false, -1, DataBuffer.TYPE_BYTE);2. If you want to use different colors in the ICM, I can imagine a couple strategies:
    a. You know the colors you want to use: use them!
    b. Your original image only has a few colors: sample the image to find out what those colors are.
    c. You have no idea what colors are in your image and how many there are, but you want to try to choose a palette that reflects its composition: for example, if your image is a sunset, your palette will have many colors in the spectrum from yellow->orange->red. Good luck! Perhaps create a collectiom of color "buckets" representing a neighboorhood around a color. For example (R,G,B) = (100,120,45) +/- 5 in each component. Then sample the image. If a bucket is empty you don't need that color; if a bucket is "overflowing" perhaps you need to subdivide the bucket into subbuckets with smaller neighboorhoods (I'll say it again: good luck!)

  • How can i read all the lines from a text file in specific places and use the data ?

    string[] lines = File.ReadAllLines(@"c:\wmiclasses\wmiclasses1.txt");
    for (int i = 0; i < lines.Length; i++)
    if (lines[i].StartsWith("ComboBox"))
    And this is how the text file content look like:
    ComboBox Name cmbxOption
    Classes Win32_1394Controller
    Classes Win32_1394ControllerDevice
    ComboBox Name cmbxStorage
    Classes Win32_LogicalFileSecuritySetting
    Classes Win32_TapeDrive
    What i need to do is some things:
    1. Each time the line start with ComboBox then to get only the ComboBox name from the line for example cmbxOption.
       Since i have already this ComboBoxes in my form1 designer i need to identify where the cmbxOption start and end and when the next ComboBox start cmbxStorage.
    2. To get all the lines of the current ComboBox for example this lines belong to cmbxOption:
    Classes Win32_1394Controller
    Classes Win32_1394ControllerDevice
    3. To create from each line a Key and Value for example from the line:
    Classes Win32_1394Controller
    Then the key will be Win32_1394Controller and the value will be only 1394Controller
    Then the second line key Win32_1394ControllerDevice and value only 1394ControllerDevice
    4. To add to the correct belonging ComboBox only the value 1394Controller.
    5. To make that when i select in the ComboBox for example in cmbxOption the item 1394Controller it will act like i selected Win32_1394Controller.
    For example in this event:
    private void cmbxOption_SelectedIndexChanged(object sender, EventArgs e)
    InsertInfo(cmbxOption.SelectedItem.ToString(), ref lstDisplayHardware, chkHardware.Checked);
    In need that the SelectedItem will be Win32_1394Controller but the user will see in the cmbxOption only 1394Controller without the Win32_
    This is the start of the method InsertInfo
    private void InsertInfo(string Key, ref ListView lst, bool DontInsertNull)
    That's why i need that the Key will be Win32_1394Controller but i want that the user will see in the ComboBox only 1394Controller without the Win32_

    Hello,
    Here is a running start on getting specific lines in the case lines starting with ComboBox. I took your data and placed it into a text file named TextFile1.txt in the bin\debug folder. Code below was done in
    a console app.
    using System;
    using System.IO;
    using System.Linq;
    namespace ConsoleApplication1
    internal class Program
    private static void Main(string[] args)
    var result =
    from T in File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TextFile1.txt"))
    .Select((line, index) => new { Line = line, Index = index })
    .Where((s) => s.Line.StartsWith("ComboBox"))
    select T
    ).ToList();
    if (result.Count > 0)
    foreach (var item in result)
    Console.WriteLine("Line: {0} Data: {1}", item.Index, item.Line);
    Console.ReadLine();
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

  • How to choose a specific version and detect the same specific version?

    I've found the following link in other posts about choosing versions programmatically:
    http://java.sun.com/products/plugin/versions.html
    Well, I'm not quite sure how to use that classid for "static versioning". I mean, if I need to use 1.3.1_08 but not others (not even 1.3.1_07 or 1.3.1_09, but only 1.3.1_08), what classid should I use?
    That page doesn't teach us what syntax we're supposed to use!
    On the other hand, my webapp needs to detect what JRE is installed and would suggest what to do in case the specific version can't be found in client computer. What should I do?
    Thirdly, I've noticed that the order of installing versions is important. Let's say there're two versions in a computer, V1 and V2, while what I need is V1. Depending on V1 or V2 is the final installed one, my detection might or might not work. Someone knows what to do?
    TIA

    galo,
    willkommen zu den Apple Diskussionen.
    You don't state which version of Keynote you're using. Keynote 3 offers an option to restart the presentation after an inactivity of x min (at least 1 min).
    Look at Document inspector on the Document tab.
    In German: Klick im Informationen-Fenster auf das weiße Blatt und ggf. den Dokument-Button. Dort findest Du:
    Präsentation als Endlosschleife
    Präsentation neu starten nach Inaktivität von
    Viel Erfolg.
    If this information is useful to you, please mark it as "helpful" or "solved" using the little buttons in the titlebar of this message. Thank you.
    PowerBook G4 17", 1GB   Mac OS X (10.4.7)   iMac G5 20"; iPod 3G, iPod Shuffle, iSight

  • How to create a button in pdf to jump to a specific location and highlight it....?

    I have a problem in making a pdf-file interactive which I suspect will have to be solved by Javascript, but I don't know the exact solution. What I want to do is to be able to create a button on a page. Clicking this button will cause the pdf reader to go highlight a specific area (stored in the button information), either on the same page or another page. The functionality could also be achieved by the button searching for a specific and unique string in the document, and subsequently highlighting it. I have looked for this functionality in pdf's, but not been able to find it. Does it already exist?. If not, can anyone come up with a hint how it can be implemented? (Javascript, anyone?) Appreciate your feedback very much.

    You will need to create custom web part editor. Look at the following example. It also have added button and its events. I am sure you can use this sample as base and code your logic.
    http://msdn.microsoft.com/en-us/library/hh228018(v=office.14).aspx
    Amit

  • Problem w/saving simple image as .png

    Hello:                                                                                                                            Level: Newbie'ish   OS: Win7 64bit   PS: CS6
    I have been making a simple image of a 300 by 100 rounded rectangle and then adding various layer styles. Basically I am makeing mobile headers which will be used for mobile websites.
    Today I was reviewing  a few that I have made and noticed that when I open them in their .png format and then create a selection around one (Ctrl + Click) that the lower right coner is not being selected as rounded but as a point and so when I copy and then paste it into a new document it has three rounded corners and one somewhat visible pointed corner.  ?? ??
    The file has a BG layer and two shape layers (or sometimes just one shape layer). I select the layers and then merge them together and turn off the BG layer beofore I save them for the web. I have also tried just saving the file as a .png w/out merging the layers but no matter how I go about saving the file(s) most of the time one corner is saved w/that annoying and imperfect sharp corner.
    Any ideas? Your time is greatly appreciated ~ Thanx a Bunch!!

    Hey c.pf...
    sorry for just getting back ~ the holiday season has me run'n Crazy.
    any way, i figured out my problem. i hadn't realized that i accidentally clicked the outer glow option and it was so faint that i couldn't see it all that well or actually ~ at all until i went back through the LS ...
    so, when i would save the image (mobile header) it was including or making room for the outer glow
    funny how something so simple can be overlooked.
    well, sorry for bothering ya over nothing ~ but i really appreciate your willingness to help me out
    hope all is well!! thanx again!

  • Image from PNG is not fully downloaded and part of Image is black

    Hi,
    I have quite slow Internet connection (sth like 3kB/s). In my application I create ImageIcon (and then Image from it) from an URL.
    Sometimes when I download quite big PNG images (sth like 400 kB) the download process made by internal JVM methods breaks up. All my methods finish properly, but suddenly I get an error:
    java.lang.ArrayIndexOutOfBoundsException
         at java.lang.System.arraycopy(Native Method)
         at sun.awt.image.PNGFilterInputStream.read(PNGImageDecoder.java:830)
         at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:213)
         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:134)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:355)
         at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:254)
         at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
         at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    and part of the image downloaded is totally black.
    Is there a way I can somehow catch this exception or change the code:
    Image img = (new ImageIcon(url)).getImage();
    so I'm sure that the whole image is downloaded?
    jacek

    Hiya Jacek,
    Try using java.awt.MediaTracker to download the image. The javadocs give an example how to use it to ensure the app waits for the image to be fully downloaded.
    Cheers,
    James

  • How do I get date as calender when a user wants to select a specific date and filter the o/p of report accordingly

    Can someone help on this..?

    Thanks I missed out that i can use a date as datatype
    Thanks for pointing out ;
    Will try that
    Also can you help me with this as well
    "https://forums.oracle.com/thread/2571086"

  • How to make Outlook 2013 calendar only show specific hours and hide the others that are grayed out

    I’d like to show 7am to 10pm thus allowing the rest of the day to be less cramped vertically on my screen.  I don't want to see all the grayed out hours which are
    outside of business hours.  How can I do this?

    Right click on the time scale and choose the next smaller scale. It may not help much since 7 -10 is a fairly long period, although with 30 min and the ribbon minimized, i see 7a - 11p on a 24" monitor. You may need to set 7 as the start of your business
    day. If you have it set later in options, outlook will start the day at the later time.
    I have screenshots here -
    http://www.outlook-tips.net/tips/tip-503-display-work-hours/
    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

  • Placing ini file in specific location when building the application

    Hello,
       I have a small problem.  I have an ini file that I use to store certain parameters.  Lets call this file app.ini.  When I build the Application.exe, it puts that file into the data directory.  I was hoping that it would be one level higher and be located in the same directory as Application.exe is (otherwise it won't read the file correctly.)  I looked at the Source File Settings in the Category list in the properties window for the build and set the Destination to be "Same as caller", but that didn't put it where I wanted it.  I'd really like this file to be one directory higher when I make my build in order for my app to read it correctly.  Any suggestions?
    I use this executable later on when I make my installer and the problem simply propagates there too, not good.
    Solved!
    Go to Solution.

    One way to solve the problem:
    1) In build properties window select Destinations and create a new destination. Select as "Destination Path" the same dir where the exe will be stored
    2) Assign this destination to the .ini file.
    Let me know if it works
    Marco

  • A picture that was saved in a word document is not showing when I open the document in Pages. Is there a way to recover the image, or a specific type of file that Pages only recognizes?

    My professor posted the course syllabus online and at the time, I was using OpenOffice. Whenever I opened the document the image would show perfectly fine, but I switched over to Pages because it had a template I know one of my professors wants a project to be done in. When I opened the same document in Pages to see if it would look the same, the error box popped up and said the image could not be imported and there was a blank box where the picture should have been. My question is, is there any way that I could somehow get the image to show or was it saved in a format that Pages doesn't recognize?

    Open the document with Open Office. Select and Copy the image. Paste it into Pages.
    If that doesn't work,
    Open the document with Open Office. Select and Copy the image. Launch Preview. Press command-N (New document from Clipboard). Save the Preview file as a PDF or JPEG, as appropriate. Insert that in Pages.
    Regards,
    Barry

  • Saving Binary Image with Overlay?

    Hi
    I'm having some issues saving an image with overlay information. I'm using IMAQ Find Circles to measure the radii of holes in a binary image. The hole data is then used with IMAQ Overlay Oval, to draw on ovals to highlight the circles detected. Works fine and the image is shown as expected in the image output on screen, pallette is set to binary. (See second image of 3, below)
    When I try and save the image to PNG I just get a blank (black) image. If I use the IMAQ Merge Overlay tool, I just get the green circles on the black (see last image of 3 below). Is there something I'm missing with pallettes/merging? Any help much appreciated. Snapshot of (messy) code attached.
    Solved!
    Go to Solution.
    Attachments:
    forum2.PNG ‏47 KB

    The problem is the binary image is all zeroes and ones.  A normal image goes up to 255, so a value of 1 looks black.
    One solution is to multiply the binary image by 255, which makes the image black and white.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • Saving webcam images into database

    Hi,
    I have managed to acquire the image from my webcam through the vision acquisition software but now i faced a problem because i want the image to be stored in the database so that it could be view from a webpage( like a video stream).
    What i did in my vi was just take the image out and connected it directly to the database and data is going in the database but when i tried to display it on the webpage it does not show.
    Is it possible to do that and if so is there any tutorials i can refer to?
    Solved!
    Go to Solution.

    You should not save an image to database, since it'll make database slow, and difficult to write a web page to load image.
    Save an image to specific location, and save image location to database.
    Then, use <img> tag to call an image in web page.

  • How to save JFrame image as png format?

    hello all..
    i've encountered some problem while i using my Java3D to load my VRML file & save it in png format.
    i've loaded the VRML file in my Java 3D and display it on the JFrame.
    now, i want to save the image as PNG format, but i can't save the image, but just save the background & canvas.
    here's my code:
    Button button = new Button("Save image");
    button.addActionListener( new ActionListener()
    public void actionPerformed(ActionEvent event)
    RenderedImage image = myCreateImage();
    // Write generated image to a file
    try {
    FileDialog fd = new FileDialog(f, "Save as PNG", FileDialog.SAVE);
    fd.show();
    String name= fd.getFile();
    // Save as PNG
    ImageIO.write((RenderedImage)image, "png", new File(name));
    catch (IOException e) {}
    content_pane.add(button, BorderLayout.SOUTH);
    try
    FileReader fr = new FileReader( "TS.java" );
    BufferedReader br = new BufferedReader(fr);
    catch(Exception e) {}
    pack();
    setLocationRelativeTo( null );
    setSize(800, 600);
    setLocation(0, 40);
    setVisible(true);
    setBackground(Color.white);
    public RenderedImage myCreateImage() {
    int width = 800;
    int height = 600;
    // Create a buffered image in which to draw
    BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bufferedImage.createGraphics();
    g2d.dispose();
    return bufferedImage;
    private void loadFile(String file) {
    int flag = VRML97Loader.LOAD_ALL;
    if(staticLoad)
    flag &= ~VRML97Loader.LOAD_BEHAVIOR_NODES;
    VRML97Loader loader = new VRML97Loader(flag);
    // if the file is a directory, ignore it
    File f = new File(file);
    if(f.exists() && !f.isFile()) {
    System.out.println("Can't load directories specified");
    System.exit(1);
    URL url = null;
    Scene scene = null;
    try {
    if(url != null)
    scene = loader.load(url);
    else
    scene = loader.load("vrml/fish.wrl");
    } catch(Exception e) {
    System.out.println("Exception loading URL:" + e);
    e.printStackTrace();
    System.exit(0);
    urlLabel.setText("File " + file);
    if (scene != null) {
    // get the scene group
    sceneGroup = scene.getSceneGroup();
    sceneGroup.setCapability(BranchGroup.ALLOW_DETACH);
    sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
    sceneGroup.compile();
    // add the scene group to the scene
    examineGroup.addChild(sceneGroup);
    // now that the scene group is "live" we can inquire the bounds
    setViewpoint();
    // setupBackground(scene);
    // setupLighting(scene);

    Your g2d is doring nothing!
    Indent your code.
    class{
       type data1;
       type data2;
       type method(){
           statement;
            clause{
               statement;

Maybe you are looking for

  • ASSIGNING addition  used in the LOOP statement

    Hello Guys , I have a problem about at new  and at end statements, basically I want to use them in a loop with  assigning  like this : loop at ti_itab assigning <wa_itab>.     at new of kunnr.     endat.     at end of xref1.     endat. endloop. xref1

  • Urgently required Crystal Reports 2008 FixPack_03 for SAP B1 8.8

    Dear All, I Urgently need Crystal Reports 2008 FixPack_03 for SAP B1 8.8. It is unavailable on the following link: Crystal Reports 2008 Reference [original link is broken] I have also searched it but unable to find it. If anyone has this, kindly shar

  • [svn:bz-trunk] 20765: change photo to line art

    Revision: 20765 Revision: 20765 Author:   [email protected] Date:     2011-03-10 10:20:42 -0800 (Thu, 10 Mar 2011) Log Message: change photo to line art Modified Paths:     blazeds/trunk/qa/apps/qa-regress/WEB-INF/src/photo/person0.jpg

  • Editable text extraction

    greetings, i have 8 years of daily data written in pencil. each day's dated data is merely one number, three digits at most with a decimal point. each paper has a month of entries (365 papers times 8). how do i get the dated data into text if it's wr

  • Need more RAM to suport Lion and don't know what to buy??

    I know I need 4g (instead of the 2g I already have).  Have 2 slots but not sure which to buy...buffered, unbuffered, ECC, SODIMM???  Please help.  it would be WAAAAY cheaper for me to order and install than the $200 apple wanted at the store. Rhianna