Saving images after opening

I have been having trouble finding a way to save images after I have them open into the program I am building. If anyone has an idea how to do this any info would be very much appreciated. Thanks

Heres a silly example:
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
* @author Ian Schneider
public class LoadAndSaveImage {
    public static void main(String[] args) throws Exception {
        BufferedImage bi = ImageIO.read(new File(args[0]));
        Graphics2D g2 = bi.createGraphics();
        g2.setColor(Color.RED);
        g2.setFont(g2.getFont().deriveFont(48f));
        g2.setTransform(AffineTransform.getRotateInstance(Math.PI/4));
        g2.drawString("I maded it better",48,48);
        g2.dispose();
        JLabel l = new JLabel(new ImageIcon(bi));
        javax.swing.JFrame f = new javax.swing.JFrame();
        f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
        f.getContentPane().add(l);
        f.pack();
        f.setVisible(true);
        if (JOptionPane.showConfirmDialog(f,"Should I save my excellent work?") == JOptionPane.OK_OPTION) {
            File out = new File("yourimagebutbetter.jpg");
            ImageIO.write(bi,"jpg",out);
            System.out.println("vandalized image saved at : " + out);
}Hopefully that will send you on your way.
I am new at this Then ignore my bad example of putting everything in main.

Similar Messages

  • Get starting address of image after openning on Photoshop window.

    Dear All,
    I am newcomer of Photoshop plug-in programming technology and I am implementing an application that get the starting address in memory of image after it was opened on Photoshop window.
    The process as follow:
    + User open an image.
    + The plug-in gets the starting address and size of image. (Pending!!!)
    Could you all give me some ideas or Photoshop API to do this?
    Thanks,
    Hieu Nguyen.

    Hi We're Gill, Siobhan and jaclyn.
    We were wondering where to get more information on copyright laws.
    if someone could get back to us ASAP that would be lovely thank you:)

  • How to save appropriate images and then discard the saved images after using.

    Hi,
    The attached program is used for gesture recognition and playing the corresponding audio file for each recognized pattern. It is saving all the images that are captured and is using in pattern matching. if pattern for "A" is captured ,then almost 10 to 15 intermediate images are captured along with pattern "A". If all are pattern matched then audio file of "A" will be played for 4 or 5 times which is not desirable. Also the images saved in the imaq write folder are getting piled up. They should be discarded after they are used up in pattern matching otherwise it would be a waste of system memory. Can anybody  advice in correcting.
    Thanking you. 
    Attachments:
    program help.zip ‏721 KB

    Hi,
    The attached program is used for gesture recognition and playing the corresponding audio file for each recognized pattern. It is saving all the images that are captured and is using in pattern matching. if pattern for "A" is captured ,then almost 10 to 15 intermediate images are captured along with pattern "A". If all are pattern matched then audio file of "A" will be played for 4 or 5 times which is not desirable. Also the images saved in the imaq write folder are getting piled up. They should be discarded after they are used up in pattern matching otherwise it would be a waste of system memory. Can anybody  advice in correcting.
    Thanking you. 
    Attachments:
    program help.zip ‏721 KB

  • Photoshop CC distorts my image after opening it (Video inside)

    Does anyone know the fix to this bug? It's been happening everytime I open a picture in photoshop. The whole picture gets distorted and weird colors appear.
    https://www.youtube.com/watch?v=XzbfD0P4dwc&feature=youtu.be

    Do you know what hardware you have?  The important thing is to do this on the GPU maker's site, so if nVidia go to
    http://www.nvidia.com/Download/index.aspx?lang=en-us

  • Saving Images after doing drag and drop

    Hi Frenz,
    I'm doing on a program on drag and drop. Bascically, I have done 2 windows, one is the main window where the drag picture will be drop on and another one is the window with picture for me to drag.I want to know am I able to save_ the main windows with the "drag & drop" picture on it?
    Your help will be very importnat to us..Thanks
    cy.

    Re,
    If you want to capture the whole content of the window you should
    create a BufferedImage of the size of the window and the default color model.
    Then create the Graphics-object and call the paint method from the
    root pane of the window.
    // Create a BufferedImage
    BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    // fetch the JRootPane
    JComponent rootPane = getRootPane();
    // create the graphics object
    Graphics2D g2d = buf.createGraphics();
    // do the paint
    rootPane.paint(g2d);
    g2d.dispose;to save this buffered image use the methods from javax.imageio.ImageIO.
    Olek

  • How to close saved image?

    hi 
    I can't close the saving image after i created it. It becomes read only and  i get error  unless i exit from application when i want to create it again  i think it remains open.
    Would you help me how i can solve problem?
     ofd.Filter = "Image Files|*.jpg;*.png;*.gif;*.bmp;|All Files (*.*)|*.*"
            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
                TextBox1.Text = ofd.FileName
                Dim img As Image = Nothing
                Dim sfilename As New System.IO.FileInfo(ofd.FileName)
                Dim yol As New FileInfo(TextBox1.Text)
                Dim f As String = System.IO.Path.GetFileNameWithoutExtension(ofd.FileName)
                Dim path As String = yol.Directory.FullName & "\" & f & yol.Extension Dim fs As FileStream = sfilename.OpenRead()
    Dim outputStream As Stream = New MemoryStream()
    AddWatermark(fs, TextBox2.Text, outputStream)
    fs.Close()
    sfilename.Delete()
    img = Image.FromStream(outputStream)
    Using savingImage As New Bitmap(img.Width, img.Height, img.PixelFormat)
    Using g As Graphics = Graphics.FromImage(savingImage)
    g.DrawImage(img, New Point(0, 0))
    End Using
    savingImage.Save(path, ImageFormat.Jpeg)
    PictureBox1.BackgroundImage = Image.FromFile(path)
    End Using
    outputStream.Close()
    img.Dispose()Public Sub AddWatermark(ByVal fs As FileStream, ByVal watermarkText As String, ByVal outputStream As Stream)
            Dim img As Image = Image.FromStream(fs)
            Dim font As New Font("Verdana", 32, FontStyle.Bold, GraphicsUnit.Pixel)
            font = FontDialog1.Font
            'Adds a transparent watermark with an 100 alpha value.
            Dim color As Color = Color.FromArgb(100, 0, 0, 0)
            'The position where to draw the watermark on the image
            Dim pt As New Point(10, 30)
            Dim sbrush As New SolidBrush(color)
            Dim gr As Graphics = Nothing
            Try
                gr = Graphics.FromImage(img)
            Catch
                ' http://support.microsoft.com/Default.aspx?id=814675
                Dim img1 As Image = img
                img = New Bitmap(img.Width, img.Height)
                gr = Graphics.FromImage(img)
                gr.DrawImage(img1, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel)
                img1.Dispose()
            End Try
            gr.DrawString(watermarkText, font, sbrush, pt)
            gr.Dispose()
            img.Save(outputStream, ImageFormat.Jpeg)
        End Sub
                                                      

    Hi,
     Here is a small example that does the same thing as your code i believe and will overwrite the opened image with the watermarked image.  Perhaps you can arrange your code to follow these steps.
    Imports System.Drawing.Imaging
    Imports System.IO
    Public Class Form1
    Private Img As Bitmap
    Private wmFont As New Font("Verdana", 32, FontStyle.Bold, GraphicsUnit.Pixel)
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Using ofd As New OpenFileDialog
    ofd.Filter = "Image Files|*.jpg;*.png;*.gif;*.bmp;|All Files (*.*)|*.*"
    If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
    Dim frmt As ImageFormat
    If Img IsNot Nothing Then Img.Dispose()
    Using i As New Bitmap(ofd.FileName)
    frmt = i.RawFormat
    Using g As Graphics = Graphics.FromImage(i)
    Using sb As New SolidBrush(Color.FromArgb(100, 0, 0, 0))
    g.DrawString(TextBox2.Text, wmFont, sb, New Point(10, 30))
    End Using
    End Using
    Img = New Bitmap(i)
    End Using
    Img.Save(ofd.FileName, frmt)
    If PictureBox1.Image IsNot Nothing Then PictureBox1.Image.Dispose()
    PictureBox1.Image = Img
    End If
    End Using
    End Sub
    End Class
    If you say it can`t be done then i`ll try it

  • Unsupported Image Format after opening a file in Photoshop.

    As from today,I am getting an unsupported Image Format after opening a file in Photoshop. I have made nothing more than as crop on the image. Why?

    Ernie, I misread your post indeed. I never saw a option to send RAW files to an external editor. All I can see is the option to chose what editor and then specify if PSD or TIFF is used. I always use PSD, usually 16bit and in one other installation in 8bit (due to RAM restrictions there).
    So Aperture creates the PSD version and PS edits that very version and saves it back into aperture. This is where I sometimes () get that "unsupported image" problem.
    I think this also is what Mike does: select a RAW master, use an external editor -> Aperture creates a PSD or TIFF. I haven't tried the TIFF option , though.
    My main point was: it all worked for a very long time and with the latest updates it is broken.
    have a good day.
    Roland

  • Once image is edited- how do I save it to desktop or a file to later insert it in an illustrator layout?  I tried to save it and it saved but it opens into photoshop elements editing page

    once image is edited- how do I save it to desktop or a file to later insert it in an illustrator layout?  I tried to save it and it saved but it opens into photoshop elements editing page

    Right click > Open with and choose the program to open it.

  • After adjusting white balance in ACR, images are opening in Ps at a different size.

    Can anyone explain like I'm 5 why this is happening, and how to prevent it? Thanks!
    Negatives are scanned at 3200dpi, and 24bit depth. This is the metadata from Bridge.
    Default settings in Camera Raw
    After opening in Photoshop.

    Scanned direclty into photoshop. And if I open the tif from explorer or bridge, bypassing Camera Raw, it opens as the 75mb file size. I thought it might have somethign to do with the color, as Bridge labels bits/channel as 'Bit depth', but the images all are 24bit, even after White Balance correction in Camera Raw.   
    Thanks for taking the time to help me figure this out. It's been causing a huge problem this week.

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

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

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

  • Image quality after opening from camera RAW

    Why does the image quality seem to get worse in Elements 11 once the image is opened up after editing from Camera RAW?  The image looks great in the RAW screen, then once opened in Photo editor it seems pixelated, smooth lines look jagged.  Is it something I am doing wrong?

    Try viewing at 25%, 50% or 75%

  • Media Browser won't open iPhoto images after 10.4.5 update!@#$%^!@#$

    Media Browser won't open iPhoto images after 10.4.5 update!@#$%^!@#$
    I could use iPhoto images in Media Browser before the update - is this happening to anyone else?
    I have restarted... no change. Maybe I'll try opening and closing iPhoto once.

    Thanks for the reply.
    I am on Pages 2 also... Hmmm, Perhaps I just don't know what I am doing - New to Pages. I see my Library, Last Roll and all my albums in the Media Browser but when I double click one of them nothing happens - Is there some other way to open them?

  • Can I retrived an auto-saved version of a project after opening the saved version by accident?

    Can I retrived an auto-saved version of a project after opening the saved version by accident?

    Unfortunately, no.
    Opening the (last) "Saved" version after a crash automatically discards the contents of the (invisible) autosave folder.

  • Fireworks CS6 Unstable & Behaves Erratically After Opening Many Images

    I use fireworks extensively for processing many images. However, after opening many large images or many more smaller images, Fireworks starts to get unstable and does funny behaviours such us keyboard shortcuts not working, tools buttons disabled even when the object is in focus, unable to select objects, etc.
    It clears up only when I restart Fireworks.
    Could Adobe look into an update for this stability fix? I would like to avoid restarting Fireworks as it resets the "Untitled" parameter and also forces me to open all the images again.
    OS: Win 7 64 Bit
    Version: Fireworks CS6

    anyone with a solution? It doesn't crash, just behaves weirdly, enough to cause annoyances. Some behaviours I have noticed when it happens
    - tools buttons are all disabled even when I have selected an object in the canvas
    - Ctrl+Tab does not work anymore

  • I saved images from an imessage.  now when I open Imessage, the pictures will not go away. When I press "done" the pictures remain. Cannot send a message

    I saved images from an imessage.  Now when I open Imessage, the pictures are displayed on the screen.  When I click on "done" the images do not go away.
    Therefore, I cannot send a message.

    Quit the app completely and try again. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar.
    Or try this.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

Maybe you are looking for

  • I forgot how to use FormsCentral

    I started using FormsCentral in April last year and was working on one specific form.  I have many different versions of the one form and I saved all of them to my desk top.  Now when I open the form, I can no longer edit it.  For the life of me, I c

  • HP U160 not support for Windows 8.1

     i brought the new HP U160 Moniter it's working good in Win 8 but when i upgrade the Windows 8.1 not detacting HP U160 Moniter and i searched for drivers in Web site there are  all so no drivers noly have Windows 8 drivers, there are no drivers for W

  • Payment term in PO to be picked from Payt trans a/c of Vendor Master

    Hi , In standard scenario Payment Term in Purchase Order is automatically picked up from Purchasing data of Vendor Master. Our requirement is Payment Term in Purchase Order should get picked up from Payment Transaction view of vendor master rather th

  • Back to back ordering

    Hi Experts, If I create a Sales Order with the Purchase Order checkbox ticked, the Sales Order creates a Purchase Order. If I open the Purchase Order and hit the button to find the target document, it opens the source Sales Order.  Is there any way t

  • I just purchased the SX60 and have been trying to find the way to change the "startup image".

    I just purchased the SX60 and have been trying to find the way to change the "startup image". I have the SX40, Sx30 SX1 and all allow me to change the startup image and the sounds through MyCamera. When I opened MyCamera, it tells me that it won't wo