How to save a hidden window to image in PWF

I want to convert a xaml to a png image using c#. I used RenderTargetBitmap. It works quite well if the xaml that's meant to be converted is displayed in a window or a page and you can actually see it on screen. But if the window is closed or hidden, a
blank image will be generated. Does anyone know why this happens or how to make it work?

Hello yf11,
You can refer to the following MSDN article:
https://msdn.microsoft.com/en-us/library/aa969819(v=vs.110).aspx
How to: Encode a Visual to an Image File
// The BitmapSource that is rendered with a Visual.
RenderTargetBitmap rtb = new RenderTargetBitmap(bi.PixelWidth, bi.PixelHeight, 96, 96, PixelFormats.Pbgra32);
rtb.Render(drawingVisual);
// Encoding the RenderBitmapTarget as a PNG file.
PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(rtb));
using (Stream stm = File.Create("new.png"))
png.Save(stm);
In this way you can save the image at a certain time when your window is still showing.
Best regards,
Barry
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.

Similar Messages

  • How to save GPS info to an image's Properties

    Dear All,
    I am trying to save GPS information to an image, but I 've got an error message: "The parameter is incorrect. WinRT information: Cannot write to the specified property (System.GPS.Latitude). The property is read-only."
    Could you please help me to find out what's the wrong with my source code?
    And is System.GPS.Latitude a read-only property? How can I change the property to read/write?
    double GPSLatitude = 25.125965;
    List<string> propertiesName = new List<string>();
    propertiesName.Add("System.GPS.Latitude");
    IDictionary<string, object> extraProperties = await photoStorageFile.Properties.RetrievePropertiesAsync(propertiesName);
    extraProperties.Add("System.GPS.Latitude", GPSLatitude);
    await photoStorageFile.Properties.SavePropertiesAsync(extraProperties);
    Thanks,
    Angie

    I'm trying to achieve the same result, but using a BitmapEncoder.
    The Latitude works fine but I just can't seem to get the Longitude to write to the file correctly.
    (All the other properties are working fine.)
    The inputStream is from the webcam via a capture control.
    Pretty sure the decoder would behave the same if inputStream was from an StorageFile though.
    Any ideas please?
    Windows.Storage.Streams.IRandomAccessStream outputStream = await imageFile.OpenAsync(FileAccessMode.ReadWrite);
    var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(inputStream);
    BitmapEncoder encoder = await Windows.Graphics.Imaging.BitmapEncoder.CreateForTranscodingAsync(outputStream, decoder);
    BitmapPropertySet bitmapPropSet = new BitmapPropertySet();
    bitmapPropSet.Add("System.Subject", new BitmapTypedValue(txtPhotoSubject.Text.Trim(), PropertyType.String));
    bitmapPropSet.Add("System.GPS.LatitudeNumerator", new BitmapTypedValue(new int[3] { 47, 38, 24471 }, PropertyType.Int32Array));
    bitmapPropSet.Add("System.GPS.LatitudeDenominator", new BitmapTypedValue(new int[3] { 1, 1, 1000 }, PropertyType.Int32Array));
    bitmapPropSet.Add("System.GPS.LatitudeRef", new BitmapTypedValue("E", PropertyType.String));
    bitmapPropSet.Add("System.GPS.LongitudeNumerator", new BitmapTypedValue(new int[3] { 122, 7, 470316 }, PropertyType.Int32Array));
    bitmapPropSet.Add("System.GPS.LongitudeDenominator", new BitmapTypedValue(new int[3] { 1, 1, 10000 }, PropertyType.Int32Array));
    bitmapPropSet.Add("System.GPS.LongitudeRef", new BitmapTypedValue("N", PropertyType.String));
    await encoder.BitmapProperties.SetPropertiesAsync(bitmapPropSet);
    await encoder.FlushAsync();
    Here's the resulting properties...
    EDIT (2nd Oct 2013)
    Only thing that seems to fix the issue is to not include the LongitudeDenominator property.
    Commenting out that line works ok.
    I also needed to leave the LatitudeDenominator as 1,1,1 and just include the whole seconds.
    Close enough.

  • How to save JavaFX chart s as images

    how to save javafx charts as images. please help me in this.
    thanks in advance

    Here is my pie2D chart. how to svae it as image file
    Stage {
    title: "Pie Chart"
    scene: Scene {
    content: [
    PieChart {
    title: "What Is Your Favorite Pie?"
    titleFont: Font { size: 24 }
    data: [
    PieChart.Data {
    value: 21
    label: "Pumpkin"
    PieChart.Data {
    value: 33
    label: "Apple"
    PieChart.Data {
    value: 17
    label: "Cherry"
    PieChart.Data {
    value: 29
    label: "3.14159"
    }

  • How to: Save many PDF files containing images as jpeg

    I have a whole lot of PDF files that only contain images. I need them to be in jpeg format however.
    To convert them I'd need to open all theses pdf files in Preview and then "save as" jpeg. This does the job wonderfully.
    But it only does so for one pdf/image at a time. There's no way I can do this for all the files.
    I need to preserve the pdf files' names, too, so I can't combine the files and insert them into one pdf. This would result in having jpegs all right, but with names that do not represent the original file names.
    How can I batch process this with Preview?
    I tried the Automator but haven't found any way of doing it there.
    Does anyone have an idea how to accomplish that?

    Hi PPAC,
    What version of Windows are you running? I found another thread about this particular issue, with two possible solutions. One is to make sure that you're logged in as an administrator, and the other is to change the compatibility to earlier version of Windows. (Right-click the Acrobat application icon, choose Properties, and then choose compatibility.)
    I'm also curious what export settings you're choosing when you save as JPEG...
    Best,
    Sara

  • With JDIC WebBrowser, how to save the content as an image ?

    I wonder if there is a way to save the WebBrowser's content (Html page with graphics) into a *.png image file ? The html page may span several screens, if I do a screen shot, I can only get the top part which I can see, but will miss the off screen contents. What I mean is : if the page is 900(W) x 3500(H) pixels, how to ask my java program to take a screen shot which can get the whole image of the WebBrowser content, including those off the bottom of the screen ?
    I was able to do this with the following method for JComponent
      public static BufferedImage Get_JComponent_Image(JComponent J_Component,Rectangle region) throws IOException   // Create a BufferedImage for Swing components. All or part of the component can be captured to an image.
       /* @param J_Component Swing component to create image from
        * @param region The region of the component to be captured to an image
        * @return image the image for the given region
        * @exception IOException if an error occurs during writing
        boolean opaqueValue=J_Component.isOpaque();
        J_Component.setOpaque(true);
        BufferedImage image=new BufferedImage(region==null?J_Component.getWidth():region.width,region==null?J_Component.getHeight():region.height,BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d=image.createGraphics();
        g2d.setClip(region);
        J_Component.paint(g2d);
        g2d.dispose();
        J_Component.setOpaque(opaqueValue);
        return image;
      }So I tried to modify this method to work for Component (since WebBrowser is a sub-class of it), I got black screen with the following modified method :
      public static BufferedImage Get_Component_Image(Component A_Component,Rectangle region) throws IOException   // Create a BufferedImage for Swing components. All or part of the component can be captured to an image.
       /* @param A_Component AWT component to create image from
        * @param region The region of the component to be captured to an image
        * @return image the image for the given region
        * @exception IOException if an error occurs during writing
        boolean opaqueValue=A_Component.isOpaque();
        Out("opaqueValue="+opaqueValue);
    //    A_Component.setOpaque(true);
        BufferedImage image=new BufferedImage(region==null?A_Component.getWidth():region.width,region==null?A_Component.getHeight():region.height,BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d=image.createGraphics();
        g2d.setClip(region);
        A_Component.paint(g2d);
        g2d.dispose();
    //    A_Component.setOpaque(opaqueValue);
        return image;
      }Can anyone tell me what I did wrong ? Thanks.
    Frank

    Hi,
    Even im looking for the same thing. I tried createImage on the panel but its giving me a blank screenshot, which i presume does not works on the embedded IE area and gives the blank screenshot of the jPanel behind it.
    Kindly post any solution you might have come up with.
    Thanx

  • When closing session, how to save all open windows , so will re-open next time logon ?

    In the older version of Firefox at the point I was closing my browsing session , I had aPopup Window say "You are about to close eg. 10 Windows , do you wish to save and re-open next session ? "I was able to have that option saving my last browsing session - to open next occasion ... in Firefox 4 - How can I have that same option ??

    Firefox 4 saves the previous session automatically, so there is no longer need for the dialog asking if you want to save the current session.<br />
    You can use "Firefox > History > Restore Previous Session" to get the previous session at any time.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.<br />
    Another possibility is to use:
    * [http://kb.mozillazine.org/Menu_differences Firefox (Tools) > Options] > General > Startup: "When Firefox Starts": "Show my windows and tabs from last time"

  • How to save, combine and retrieve the images on hard drive using IMAQ in labview

    Hi,
    I am using NI-1426 frame grabber to capture images of 800x1 resolution with 270 bands. Actually, I want to capture images from camera and saving into the hard drive continuously so that my buffer does not run out of memory.  After capturing say 100 images of same resolution (800x1), I want to combine all images into ENVI format and then again save on hard-drive. Please guide me how can I do that?
    Thanks
    Sidd 

    Hi Jeff,
    Let me explain it in little detail.
    I am using PCI NI-1426 frame grabber to capture the images at particular frame rate. Ni-1426 has 2 ports i.e. 26 pin camera and 15 pin triggering port. I am sending the pulse per second (pps) signal from gps to the triggering port. I want to check for the pps signal through the frame grabber 15 pin port. Please tell me how can I listen to a trigger through a frame grabber in labview? As I have connected pps signal on pin1 in 15 pin port, I want to read that pin. or how can I read a particular  pin data in labview? I have already checked that I am getting pps signal through oscilloscope.
    Thanks
    Regards,
    Sidd 

  • How to save Real Player/Windows Media Player Files

    After watching a streamed news story (both in RP and WMP), I tried to save the file, but couldn't figure out how to do it. Can it be done?

    After watching a streamed news story (both in RP and
    WMP), I tried to save the file, but couldn't figure
    out how to do it. Can it be done?
    You will need a third party solution such as Snapz Pro X
    http://www.ambrosiasw.com/utilities/snapzprox/
    iFelix

  • How to save pdf in windows XP pro and read in osx 10.6.1?

    Hi all, Mac newbie here! So i have finally managed to install XP pro on macbook pro (NTFS partitioned in bootcamp) and what i am wondering is where do i save a PDF to (created in Windows) if i want to read in OSX (ie to email to someone)? And where do i find a file from OSX while in windows (ie a jpeg)? Many thanks.

    Hi catweasil,
    first off, let me suggest some basic links
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/switch101/
    and the Tutorials from here: http://www.apple.com/mac/
    XP: Double-click on 'My Computer' - then click on the harddisk (C:) - do a right-click and choose 'New Folder' - name the new folder to your liking.
    OSX: Double-click on the OSX Harddisk icon - in the Finder window do a right-click and choose 'New Folder' - name the new folder to your liking
    Regards
    Stefan

  • (mapviewer) how to save map as an image

    I open a mapviewer in web page, and load a map.
    I wonder how to save this map as an image?
    thx
    tamsun

    Hey, I was wondering how I could save my graphics as an image,Don't know if you can save Graphics as an Image, but you can draw a JComponents image to an Image. Search the forum using "screenimage" to find my class that does this.

  • Automatically save all poster points as images

    I understand how to save a frame as an image by doing Timeline/Save Frame As File, but I would like to save an image for each posterpoint in my home movies as a simple reference as to what is on the dvd.
    What is the easiest way to save 24 posterpoint frames as images?
    I am using Encore CS3 (3.0.1.008)
    Thanks!

    Any such script would fail with a error once it tried to exceed Photoshop 53 Alpha Channel limit.  If a document had 53 alpha channels to begin with the script would fail saving the first alpha channel it would try to save.  I know this for a have a script that tries to create my kind of collage template PSD files that has no Image layers but has alpha channels to map the locations where images will be populated.  I had to program the script to catch that there were more the 53 prototype image layers.
    IMO with the exception of the background layer all layers have Alpha Channel its actual pixel map. This invisible Alpha channel maps the layers actual pixels locations and is used in conjunction with any enable layer masks when pixels are rendered for the layer.  What I was trying to do was to create a collage template that had Alpha channel to map the locations of where Image would be placed. . I would open a document the size and resolution I wanted the collage to have. Then add an empty layer the use a selection tool to make a 4"x6" selection and fill with pixels..  Duplcate that layer for as many image I wanted. And I would position the layer where I want the image to be located.  I would then  run the script.  It would save Alpha channels for each image location and at the end flatten the layer image prototype stack to stamp the image locations onto the required background layer.  Once I reached 54 image layers  the script failed and I realized that my Collage Scripts and templates were limited to a maximum of 53 images.

  • Save file to window never stays in center, it always goes back to the top-left. how do i make it stay in the center?

    When I decide to save a file or a image on any site, The window that comes up to "save to" never stays in the center where I want it, It will always open on the top-left portion. How can I make it save its windows setting?

    help?

  • How backup/save software installed on T400 before doing clean install of Windows 7?

    Hi
    I have a Thinkpad T400  2764-CTO Running Vista Business 32-bit  and want to do a clean install to Windows 7 Pro.
    Sounds like I can get all the drivers via System Update 4.0, but I'm concerned about how to save/re-install some of the software that came on the machine.
    In particular, Intervideo WinDVD and Roxio Media Import. If I go to my Programs folder and copy the folders for Roxio and InterVideo onto a flash drive, and then re-copy into the Programs folder on the C drive after a clean install, does that work?
    I've never used Rescue and Recovery on the laptop, and am not sure how it works. Any advice is appreciated.
    I'm not sure I even know all the stuff that exists from the factory. Anything else I should be concerned about? Thanks! - Kathleen

    "In particular, Intervideo WinDVD and Roxio Media Import. If I go to my Programs folder and copy the folders for Roxio and InterVideo onto a flash drive, and then re-copy into the Programs folder on the C drive after a clean install, does that work?"
    As Maliha said (or implied) that doesn't work.  Just copying installed programs doesn't set up the registry entries or any data folders and files they may use in your user files.
    You might consider copying your entire user directory to large flash or DVD or external hard drive as a way to preserve your personal data and program data files.  Things like Thunderbird mail or Firefox bookmarks are in C:\users\kathleenklein\appdata\... (which may not be visible unless you make them so) and can be plugged back into your Windows 7 install.
    "I've never used Rescue and Recovery on the laptop, and am not sure how it works. Any advice is appreciated."
    First, have you made your factory recovery media?  That ensures that you can revert to factory Lenovo setup if you ever want to.  To give the machine to your little brother, for instance.  It will burn a pair of CDs and one or more DVDs.
    You can/should also use R&R to save a current whole-disk image to external media.  That lets you fall back to your current setup if necessary.  This is likely to be fairly large.  An external hard drive is usually required.  Use advanced R&R to set up the target and start things off.  Once you are sure that Win 7 is going to work for you, you can get rid of the saved Vista image and use the drive for your Windows 7 backups.   You do make backups...
    R&R can't (AFAIK) save your Vista user stuff and restore it to WIn 7.
    Is this a clean install using Lenovo media or is it Microsoft vanilla?  I just did a MS Vanilla 7 install.  Since the service and recovery partitions in the Lenovo Visa drive configuration will be useless in a WIn 7 install (if MS vanilla) I used the advanced option and had the Win 7 install delete all partitions and just do its thing.  It created a small boot partition and used the rest of the drive for C:
    After installing '7, install the latest TVSU and let it pull down the basic/necessary Lenovo drivers and apps.  After that you may choose to install the latest R&R.  Surprisingly, it can be used to make backups even without the Lenovo partitions present.  I've verified that by making a full image and restoring to a bare drive.
    It's handy to Install '7, do a MS update, install TVSU, do a Lenovo update, install R&R and then burn a recovery set of CDs and DVDs so you can rewind to a sort of base-usefull-initially-updated condition should that be necessary.
    As you probably already know, start here for your Lenovo Win 7 downloads: ThinkVantage Technologies Updates
    Likely more or less than you wanted - but you asked
    Z.
    The large print: please read the Community Participation Rules before posting. Include as much information as possible: model, machine type, operating system, and a descriptive subject line. Do not include personal information: serial number, telephone number, email address, etc.  The fine print: I do not work for, nor do I speak for Lenovo. Unsolicited private messages will be ignored. ... GeezBlog
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • How to save an edited viceo clip in premier elements 11 to my organizer (windows 07)?

    How to save an edited video clip in premier elements to my organizer so that I can add teh edited video clip to my slide show on windows 7 operating system?

    sanford5
    This is not Adobe. We are Premiere Elements users trying to help other Premiere Elements users with their Premiere Elements workflows. Under those conditions, only Adobe may have the opportunity to access your computer in troubleshooting session between you and them. You can use the following link to contact Adobe via its Adobe Chat.
    http://helpx.adobe.com/contact.html?product=premiere-elements&topic=using-my-product-or-se rvice
    When the link opens, click on the statement "I still need help" to bring up Adobe Chat.
    I have no idea if they will charge you a fee for the service ($40 US dollar/hour). It might not even help you (fee or no fee) because you do not have the latest version of Premiere Elements.
    What you ask is easy enough. Let me try again with a step by step to see if we can get this working for you in principle and then fine tune the details.
    1. Export your Timeline to a file, using Publish+Share/Computer and then one of the choices
    Adobe Flash Video, MPEG, AVCHD, AVI, Windows Media, QuickTime, Image, Audio. I do not know what your project settings are, but I am going to guess at NTSC/AVCHD/Full HD1080i30. That would represent 1920 x 1080 @ 29.97 interlaced frames per second.
    The following is going to be a mini test run in principle so we will cut to the core and overlook some things.
    Go to Publish + Share/Computer/AVCHD/ and set Presets = MP4 - H.264 1920 x 1080p30.
    Note that there is a field for Save In: near where you set Presets. Set the Save In for Libraries/Documents not C:\Program Files\Adobe\Adobe  Premiere Elements 11. Keep out of the Program Files for matters such as these.
    Go to the Elements Organizer 12 File Menu/Get Photos and Videos/From Files and Folders and then browse to and select your MP4 file that you have saved in Libraries/Documents.
    You now should have your video represented in the Elements Organizer 12 with a thumbnail.
    Please let us know if that works for you. If not, then please let us know where you need supplemental help to get the task completed. I will re-write if necessary.
    We will be watching for your results.
    Thank you.
    ATR
    Add On...A little side note for later...If you took your file saved to the computer hard drive and imported that back into Premiere Elements with Premiere Elements' Add Media/Files and Folders, you would get
    a. the file imported into a new project
    but also
    b. a copy of the file automatically placed in the Elements Organizer 12.
    If the ideas seem overwhelming, please take the steps on one at a time and follow exactly what is written. You should do fine.

  • How to save an image as PDF?

    Hi,
    I need help o how to save an Image as PDF file?? is this possible?

    Under Getting Started in the welcome window click Create PDF
    Open your image
    File>Save As...PDF
    But I am finding that there are limitations on how big the image can be. I am trying to save a 20mb jpeg to pdf in acrobat and having issues. Good luck!

Maybe you are looking for

  • My camera won't open. How do I fix it?

    My camera won't open. How do I fix it? It been like this for the last few days/: I really need it fixed! Please help!

  • Ip service reflect

    I have 2 systems in different locations sending to the multicast address 239.192.201.19 on port 55304 - I have been tasked with sending both of these feeds into another system for analysis.  So immediately you can see the problem. After some googlein

  • Question for ALL*MYTEE

    Hello, in your post re: Halo vs. Ensemble, you mentioned a work-around for logic control surfaces. I've tried the bit where I turn on the Ensemble after the controllers are recognized, but the controllers, though recognized, still exhibit buggy behav

  • Activation on second hand copy of Adobe Creative Suite 5 Design premium student

    My son attends Middle Tennessee State Univerversity. I was considering buy this second hand(used) for him. Will he be able to used this? Thanks for your help. Mike

  • Integration Broker : Sending peoplesoft Data into JMS queues using  IB

    Hi All, I am working on integration of peoplesoft and SOA middleware. I am basically SOA middleware developer. So not much aware at peoplesoft side. My requirement is that need to extract information from peoplesoft and send it to third party systems