Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. i need help

i need help

Scheduled Pinned Locked Moved C#
graphicshelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohamed El Wehishy
    wrote on last edited by
    #1

    hi guys i captured an image ok then i want to repeat this image to three times and the all four images are saved in one file that file in a jpg format my code is

    Graphics g1 = pictureBox1.CreateGraphics();

                Image  MyImage = new Bitmap(pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, g1);
                Graphics g2 = Graphics.FromImage(MyImage);
                IntPtr dc1 = g1.GetHdc();
                IntPtr dc2 = g2.GetHdc();
                BitBlt(dc2, 0, 0, pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, dc1, 0, 0, 13369376);
                MyImage.Clone();
                g1.ReleaseHdc(dc1);
                g2.ReleaseHdc(dc2);
                MyImage.Save(@"c:\\PrintPage.jpg", ImageFormat.Jpeg);
    

    thanks, Mohamed El-Wehishy

    L 1 Reply Last reply
    0
    • M Mohamed El Wehishy

      hi guys i captured an image ok then i want to repeat this image to three times and the all four images are saved in one file that file in a jpg format my code is

      Graphics g1 = pictureBox1.CreateGraphics();

                  Image  MyImage = new Bitmap(pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, g1);
                  Graphics g2 = Graphics.FromImage(MyImage);
                  IntPtr dc1 = g1.GetHdc();
                  IntPtr dc2 = g2.GetHdc();
                  BitBlt(dc2, 0, 0, pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height, dc1, 0, 0, 13369376);
                  MyImage.Clone();
                  g1.ReleaseHdc(dc1);
                  g2.ReleaseHdc(dc2);
                  MyImage.Save(@"c:\\PrintPage.jpg", ImageFormat.Jpeg);
      

      thanks, Mohamed El-Wehishy

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, this is what I would try (not tested), and it doesn't use a PictureBox:

      Bitmap bmIn=(Bitmap)Image.FromFile(sourceFile);
      Bitmap bmOut=new Bitmap(4*bmIn.Width, bmIn.Height);
      Graphics grOut=Graphics.FromImage(bmOut);
      for(int i=0; i<4; i++) grOut.DrawImage(bmIn, bmIn.Width*i, 0);
      bmOut.Save(destinationFile, ImageFormat.Jpeg);
      grOut.Dispose();
      bmIn.Dispose();
      bmOut.Dispose();

      :)

      Luc Pattyn


      Local announcement (Antwerp region): Lange Wapper? Neen!


      M 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, this is what I would try (not tested), and it doesn't use a PictureBox:

        Bitmap bmIn=(Bitmap)Image.FromFile(sourceFile);
        Bitmap bmOut=new Bitmap(4*bmIn.Width, bmIn.Height);
        Graphics grOut=Graphics.FromImage(bmOut);
        for(int i=0; i<4; i++) grOut.DrawImage(bmIn, bmIn.Width*i, 0);
        bmOut.Save(destinationFile, ImageFormat.Jpeg);
        grOut.Dispose();
        bmIn.Dispose();
        bmOut.Dispose();

        :)

        Luc Pattyn


        Local announcement (Antwerp region): Lange Wapper? Neen!


        M Offline
        M Offline
        Mohamed El Wehishy
        wrote on last edited by
        #3

        thanks very much my friend it is done thanks Mohamed El-Wehishy

        L 1 Reply Last reply
        0
        • M Mohamed El Wehishy

          thanks very much my friend it is done thanks Mohamed El-Wehishy

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          you're welcome. :)

          Luc Pattyn


          Local announcement (Antwerp region): Lange Wapper? Neen!


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups