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. losing resolution when using PNG as background image

losing resolution when using PNG as background image

Scheduled Pinned Locked Moved C#
helpquestiontutorial
14 Posts 4 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
    Mostafa Siraj
    wrote on last edited by
    #1

    Hi all, I have a PNG image -with very high resolution- I want to use it as background image for my form and make the form transparent. the problem is when I do that I lose the resolution, I tried to use PictureBox but I still have the same problem so the question is. How to solve this problem or if I'm using the wrong way, how can I build a form with the look I want from PNG image -I care for the image to be PNG to have the shape I want for the form- Thanks in Advance really appreciate your help.

    L 1 Reply Last reply
    0
    • M Mostafa Siraj

      Hi all, I have a PNG image -with very high resolution- I want to use it as background image for my form and make the form transparent. the problem is when I do that I lose the resolution, I tried to use PictureBox but I still have the same problem so the question is. How to solve this problem or if I'm using the wrong way, how can I build a form with the look I want from PNG image -I care for the image to be PNG to have the shape I want for the form- Thanks in Advance really appreciate your help.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What do you mean by "losing resolution"? The PNG format is lossless. Do you have a screenshot of your application? regards

      M 1 Reply Last reply
      0
      • L Lost User

        What do you mean by "losing resolution"? The PNG format is lossless. Do you have a screenshot of your application? regards

        M Offline
        M Offline
        Mostafa Siraj
        wrote on last edited by
        #3

        this is the original image before using it in the form http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg how can I keep the good resolution at the first when I use it as a background image for my form??? Thanks

        G L L 3 Replies Last reply
        0
        • M Mostafa Siraj

          this is the original image before using it in the form http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg how can I keep the good resolution at the first when I use it as a background image for my form??? Thanks

          G Offline
          G Offline
          Gareth H
          wrote on last edited by
          #4

          Mostafa Siraj, Voting someones answer as bad, wont get you much help if its a valid response.

          Regards, Gareth. (FKA gareth111)

          L 1 Reply Last reply
          0
          • G Gareth H

            Mostafa Siraj, Voting someones answer as bad, wont get you much help if its a valid response.

            Regards, Gareth. (FKA gareth111)

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

            Hi Gareth, the 1 vote may be due to the (IMO stupid) voting change: instead of having 1 to 5 options, a reply now only has "helpful" and "not helpful". Well, replying with one or more questions is strictly speaking NOT helpful. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Voting for dummies? No thanks. X|


            L 1 Reply Last reply
            0
            • M Mostafa Siraj

              this is the original image before using it in the form http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg how can I keep the good resolution at the first when I use it as a background image for my form??? Thanks

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

              Hi, your two images have different sizes, so something is scaling down (and harming quality while doing that). Possible culprits: - you have a PictureBox and have set the display mode to "Scale"; - you have a system with a non-standard dpi setting (default is 96dpi, somewhere deep down in Display Settings, you can increase that number, resulting in some strange effects). :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              Voting for dummies? No thanks. X|


              M 1 Reply Last reply
              0
              • M Mostafa Siraj

                this is the original image before using it in the form http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg how can I keep the good resolution at the first when I use it as a background image for my form??? Thanks

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Looks like the PictureBox is scaling and compressing the image in some way. What I would suggest is scaling the image to the correct size that will be used in the application using a program like Photoshop or Paint.NET. These use proper resizing algorithms that don't produce such a edgy result by using some sort of anti-aliasing. As for the second image, I don't know where the compression artifacts suddenly come from as a PictureBox does support PNG images. I guess this is just because you used the jpg format to save the screenshot. regards

                M 1 Reply Last reply
                0
                • L Luc Pattyn

                  Hi Gareth, the 1 vote may be due to the (IMO stupid) voting change: instead of having 1 to 5 options, a reply now only has "helpful" and "not helpful". Well, replying with one or more questions is strictly speaking NOT helpful. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  Voting for dummies? No thanks. X|


                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Luc Pattyn wrote:

                  Well, replying with one or more questions is strictly speaking NOT helpful.

                  If I need more information to help the OP because his question was lacking some important facts, then I don't see how asking for more information is a bad answer. regards

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    Luc Pattyn wrote:

                    Well, replying with one or more questions is strictly speaking NOT helpful.

                    If I need more information to help the OP because his question was lacking some important facts, then I don't see how asking for more information is a bad answer. regards

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

                    I agree with your questions. it is not bad. but literally speaking it is not helpful, it did not solve his problem! :)

                    Luc Pattyn [Forum Guidelines] [My Articles]


                    Voting for dummies? No thanks. X|


                    1 Reply Last reply
                    0
                    • L Lost User

                      Looks like the PictureBox is scaling and compressing the image in some way. What I would suggest is scaling the image to the correct size that will be used in the application using a program like Photoshop or Paint.NET. These use proper resizing algorithms that don't produce such a edgy result by using some sort of anti-aliasing. As for the second image, I don't know where the compression artifacts suddenly come from as a PictureBox does support PNG images. I guess this is just because you used the jpg format to save the screenshot. regards

                      M Offline
                      M Offline
                      Mostafa Siraj
                      wrote on last edited by
                      #10

                      Actually I generated the png file from Photoshop and it generates as you see a very good results but the problem is when I'm using it as a background image, it looses its resolution, and no the bad resolution at the second page is not because of the screen shooting it's the look of the form I have. no one face such a problem before I thought that it's common, how do you create your forms???

                      1 Reply Last reply
                      0
                      • L Luc Pattyn

                        Hi, your two images have different sizes, so something is scaling down (and harming quality while doing that). Possible culprits: - you have a PictureBox and have set the display mode to "Scale"; - you have a system with a non-standard dpi setting (default is 96dpi, somewhere deep down in Display Settings, you can increase that number, resulting in some strange effects). :)

                        Luc Pattyn [Forum Guidelines] [My Articles]


                        Voting for dummies? No thanks. X|


                        M Offline
                        M Offline
                        Mostafa Siraj
                        wrote on last edited by
                        #11

                        about the 2 suggestion -the display mode for the PictureBox is in "Scale" already -I created in photoshop photos with dpi up to 5000 and all of them just turn to the bad resolution as soon as I put them in the application :(:(:(:(

                        L 1 Reply Last reply
                        0
                        • M Mostafa Siraj

                          about the 2 suggestion -the display mode for the PictureBox is in "Scale" already -I created in photoshop photos with dpi up to 5000 and all of them just turn to the bad resolution as soon as I put them in the application :(:(:(:(

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

                          Hi, what is the value of PictureBox.SizeMode? you might want to show all the code relating to the PictureBox. Any chance of publishing the actual PNG file, so we could experiment a bit with it? :)

                          Luc Pattyn [Forum Guidelines] [My Articles]


                          Voting for dummies? No thanks. X|


                          M 1 Reply Last reply
                          0
                          • L Luc Pattyn

                            Hi, what is the value of PictureBox.SizeMode? you might want to show all the code relating to the PictureBox. Any chance of publishing the actual PNG file, so we could experiment a bit with it? :)

                            Luc Pattyn [Forum Guidelines] [My Articles]


                            Voting for dummies? No thanks. X|


                            M Offline
                            M Offline
                            Mostafa Siraj
                            wrote on last edited by
                            #13

                            this is the PNG file (it was already published) http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg I tried SizeMode=StretchImage && also I tried SizeMode=Zoom and both still have the same bad resolution

                            L 1 Reply Last reply
                            0
                            • M Mostafa Siraj

                              this is the PNG file (it was already published) http://img27.picoodle.com/img/img27/4/7/12/f\_OriginalImam\_f44b121.png this is after I use it as a background image in the form http://img34.picoodle.com/img/img34/4/7/12/f\_Thisisafterm\_5d8b51e.jpg I tried SizeMode=StretchImage && also I tried SizeMode=Zoom and both still have the same bad resolution

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

                              Hi, I can paint your PNG image on a Panel at different scales and it always looks good. Your JPG captured image has several anomalies: - where is the little close box coming from (top, almost right)? - seems like it was first scaled down a lot, then scaled up again. could it be the image gets loaded while the PictureBox is small, then the PB size gets increased but the image itself is no longer available? or something similar? Anyway I wouldn't trust a PictureBox much, and do my own scaling, hence SizeModes Normal and AutoSize have my preference. Have you been playing around with alpha channel, transparency? Tell us the entire story, and show us some code. :)

                              Luc Pattyn [Forum Guidelines] [My Articles]


                              Voting for dummies? No thanks. X|


                              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