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 / C++ / MFC
  4. Saving a (image) file in different format

Saving a (image) file in different format

Scheduled Pinned Locked Moved C / C++ / MFC
htmldatabasetutorialquestion
12 Posts 7 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.
  • S snir_ya

    Hi, I'm generating an html page on-the-fly in my application. This page should contain images. The images i have in the DB are of formats that cannot be used in html (jpeg, png etc) so i need to save them in gif format. Does anybody have a lead on how to save these image files in gif format? Thanks in advance.

    T Offline
    T Offline
    Tara14
    wrote on last edited by
    #2

    I guess you can open them in MS Paint and then save them to the bmp/gif format. Paint does the conversion._


    Fortitudine Vincimus!_

    S 1 Reply Last reply
    0
    • T Tara14

      I guess you can open them in MS Paint and then save them to the bmp/gif format. Paint does the conversion._


      Fortitudine Vincimus!_

      S Offline
      S Offline
      snir_ya
      wrote on last edited by
      #3

      :) Sure, but but this has to be implemented on-the-fly. The DB is dynamic and i don't know in advance what's its content. It has to be done in coding. Thanks anyway.

      1 Reply Last reply
      0
      • S snir_ya

        Hi, I'm generating an html page on-the-fly in my application. This page should contain images. The images i have in the DB are of formats that cannot be used in html (jpeg, png etc) so i need to save them in gif format. Does anybody have a lead on how to save these image files in gif format? Thanks in advance.

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #4

        you can certainly use both JPG and PNG in HTML. Cleek | Image Toolkits | Thumbnail maker

        J 1 Reply Last reply
        0
        • C Chris Losinger

          you can certainly use both JPG and PNG in HTML. Cleek | Image Toolkits | Thumbnail maker

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #5

          I suppose that depends entirely on what braindead (or not) browser you've got.

          -- Presented in BC [Brain Control] where available

          1 Reply Last reply
          0
          • S snir_ya

            Hi, I'm generating an html page on-the-fly in my application. This page should contain images. The images i have in the DB are of formats that cannot be used in html (jpeg, png etc) so i need to save them in gif format. Does anybody have a lead on how to save these image files in gif format? Thanks in advance.

            B Offline
            B Offline
            bob16972
            wrote on last edited by
            #6

            GDI+ is the simplest to use for image format conversions. You simply load the image, set the encoder and save the image to file or stream. GDI+ is slow but it has proven itself to be very useful in terms of image manipulation and advanced effects. It has a native C interface that Microsoft wraps with a C++ wrapper class. Be forewarned, if you come from an MFC background, their wrapper classes are somewhat frustrating and obviously designed by the Herb Sutter camp of "You should not be coding that way so we'll make it harder to shoot yourself in the foot" program team. But, at the end of the day, it saved me tons of development time so I tend to overlook it's poor interface and still recommend it when performance is not critical.

            J 1 Reply Last reply
            0
            • B bob16972

              GDI+ is the simplest to use for image format conversions. You simply load the image, set the encoder and save the image to file or stream. GDI+ is slow but it has proven itself to be very useful in terms of image manipulation and advanced effects. It has a native C interface that Microsoft wraps with a C++ wrapper class. Be forewarned, if you come from an MFC background, their wrapper classes are somewhat frustrating and obviously designed by the Herb Sutter camp of "You should not be coding that way so we'll make it harder to shoot yourself in the foot" program team. But, at the end of the day, it saved me tons of development time so I tend to overlook it's poor interface and still recommend it when performance is not critical.

              J Offline
              J Offline
              Joe Woodbury
              wrote on last edited by
              #7

              bob16972 wrote:

              their wrapper classes are somewhat frustrating

              I once worked with a guy who had been on the GDI+ team (or done some work for them; was never clear on that.) My first question was: Why? His eventual answer was that the whole thing was essentially a proof-of-concept and never intended to be released. My next question was whether Microsoft Engineers have to put up with designs like this for stuff that really is internal. I got no answer. (Given the horrific design of the TreeView and ListView controls, I suspect I knew the answer.) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

              B 1 Reply Last reply
              0
              • J Joe Woodbury

                bob16972 wrote:

                their wrapper classes are somewhat frustrating

                I once worked with a guy who had been on the GDI+ team (or done some work for them; was never clear on that.) My first question was: Why? His eventual answer was that the whole thing was essentially a proof-of-concept and never intended to be released. My next question was whether Microsoft Engineers have to put up with designs like this for stuff that really is internal. I got no answer. (Given the horrific design of the TreeView and ListView controls, I suspect I knew the answer.) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                B Offline
                B Offline
                bob16972
                wrote on last edited by
                #8

                Joe Woodbury wrote:

                Why?

                :-D It is indeed an oddity why they didn't just add some additional flags to some GDI functions and a few new methods for the image manipulation routines. At this point in the game, I'm glad the additional functionality is available somewhere since implementing routines for all the image file formats would have set me back a few more years.

                Joe Woodbury wrote:

                never intended to be released

                The sad part is, I was actually anticipating the next release of GDI+ for roughly a year until I came to my senses and realized they had indeed abandoned it's development in favor of the utilization of the DirectX layer that now is apparently underneath all the Vista graphics. Live and learn. :: sigh ::

                E 1 Reply Last reply
                0
                • B bob16972

                  Joe Woodbury wrote:

                  Why?

                  :-D It is indeed an oddity why they didn't just add some additional flags to some GDI functions and a few new methods for the image manipulation routines. At this point in the game, I'm glad the additional functionality is available somewhere since implementing routines for all the image file formats would have set me back a few more years.

                  Joe Woodbury wrote:

                  never intended to be released

                  The sad part is, I was actually anticipating the next release of GDI+ for roughly a year until I came to my senses and realized they had indeed abandoned it's development in favor of the utilization of the DirectX layer that now is apparently underneath all the Vista graphics. Live and learn. :: sigh ::

                  E Offline
                  E Offline
                  earl
                  wrote on last edited by
                  #9

                  libtiff libjpeg are decent places to start. You might have to write the code that dumps to gif, I dunno, but at least the first two will decompress to bitmap or something similar. Why, again, do you think browsers won't read jpg or png? earl

                  B 1 Reply Last reply
                  0
                  • E earl

                    libtiff libjpeg are decent places to start. You might have to write the code that dumps to gif, I dunno, but at least the first two will decompress to bitmap or something similar. Why, again, do you think browsers won't read jpg or png? earl

                    B Offline
                    B Offline
                    bob16972
                    wrote on last edited by
                    #10

                    earl wrote:

                    Why, again, do you think browsers won't read jpg or png?

                    When exactly did I say that? I think your post got linked incorrectly

                    E 1 Reply Last reply
                    0
                    • B bob16972

                      earl wrote:

                      Why, again, do you think browsers won't read jpg or png?

                      When exactly did I say that? I think your post got linked incorrectly

                      E Offline
                      E Offline
                      earl
                      wrote on last edited by
                      #11

                      Sorry, not you Bob, snir_ya

                      B 1 Reply Last reply
                      0
                      • E earl

                        Sorry, not you Bob, snir_ya

                        B Offline
                        B Offline
                        bob16972
                        wrote on last edited by
                        #12

                        No problem. Take care.

                        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