Resizing of Images

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #45907
    Support
    Keymaster

      Hello

      TsAlphaImageList component can change Width and Height properties on the fly, maybe this feature can help you?

      #45912
      bdegli
      Participant

        I tried to use it

        Could you please give an example how to copy an image from a 32×32-imagelist to a 16×16 imagelist?

        #45929
        Support
        Keymaster

          Why you want to copy it? You can just change Width and Height properties in the AlphaImageList component…

          #45989
          bdegli
          Participant

            My project is rather big more than 100 icons …

            To have 3 different image_list in 16×16 24×24 32×32 or even a view in 128×128 …

            costs a lot of memory and the management is quite diffucult to synchronize them

            button List16 image index 56 equals to List32 index 56 …

            If I have only one Image-List and size them at runtime … all icons change and not only a specific …

            If I create a new TabSheet from a Menu Button – I just want to copy the image from the button-Image-Source to the

            PageControl-Image Source and by the way adjust the size … A lot of my Forms are dynamically created at runtime…

            #45990
            bdegli
            Participant

              My project is rather big more than 100 icons …

              To have 3 different image_list in 16×16 24×24 32×32 or even a view in 128×128 …

              costs a lot of memory and the management is quite diffucult to synchronize them

              button List16 image index 56 equals to List32 index 56 …

              If I have only one Image-List and size them at runtime … all icons change and not only a specific …

              If I create a new TabSheet from a Menu Button – I just want to copy the image from the button-Image-Source to the

              PageControl-Image Source and by the way adjust the size … A lot of my Forms are dynamically created at runtime…

              [attachment=4907:menu_Scrn1.jpg]

              #45992
              Support
              Keymaster

                I think I understand a problem now.

                I'll plan to make a new component later. This component will take icons from AlphaImageList and change size to any other on the fly.

                This component will be inherited from standard ImageList and may be used as ImageList.

                #49317
                SzakiLaci
                Participant
                  'Support' wrote:

                  I think I understand a problem now.

                  I'll plan to make a new component later. This component will take icons from AlphaImageList and change size to any other on the fly.

                  This component will be inherited from standard ImageList and may be used as ImageList.

                  Hi,

                  I have the same problem, since I've started to use nice, big, scalable (non resized) icons with TsAlphaImageList.

                  I was thinking a lot about a solution, and realized, the easiest way would be to use a “Virtual Imagelist”

                  Solution 1.:

                  making a new component called TsVirtualImageList, having no images itself, but pointing to an other TsAlphaImageList.

                  Solution 2.:

                  altering the current TsAlphaImageList component by adding a:

                  property UseVirtually: TsAlphaImageList;

                  The first case is quicker, the 2th case is more elegant, but following things had to be done:

                  – by selecting UseVirtually >> checking if TsAlphaImageList is already using UseVirtually property ( nil) to prevent circular reference.

                  rewriting procedures (maybe not all, just the Create and Destroy)

                  – checking if the original TsAlphaImageList is still Assigned() before making any changes trying to read from it.

                  Solution 3.:

                  Rewriting all components (like TsBitButton, …) to set unique picture drawing size and property (like: Origin=orUpperCenter; Width=16; Height=24, AutoScaled=False, Proportional=False …)

                  #49322
                  Hamilton
                  Participant

                    Hi,

                    If you're not concerned about image quality then this seems like something that could be implemented fairly easily. However, if the image quality is important then this concept is a *lot* of work. I use the Graphics32 libraries (http://graphics32.org) for this purpose myself because the VCL image resizing routines are *TERRIBLE*. Put it this way: if you have an image 128 pixels wide to fit into a 32 pixel wide image then Delphi routines remove every 4th pixel from the original… sometimes it works just fine other times you end up with garbage. I don't know if you could, or would want to, hook in an advanced library like that to do the resizing but if you don't you might not get a result you'd want to use.

                    Some graphics programs allow command line parsing for functions such as resizing images and IMO you're probably better off looking into that, or manually resizing your images in a graphics program (not Paint) and then saving them in a new list the correct size. HDD's and RAM are cheap and there isn't much benefit worrying about things like that when the OS you're building your app on doesn't.

                    This is all just my opinion though, who knows Serge might have some tricks for this up his sleeve, or maybe icon style images are small enough that the quality doesn't matter.

                    Regards,

                    Hamilton

                    EDIT: This post clicked me over from being “Advanced” to “The Aged”. I don't know if it was worth it!

                    #49327
                    Support
                    Keymaster

                      Hello!

                      TsVirtualImageList will be created soon. I think, this component will work good. 🙂

                      #49475
                      SzakiLaci
                      Participant

                        Any progress? 😉

                        Thanks !

                        #49476
                        Support
                        Keymaster

                          Yes, but component is not ready still because publishing of stable version had a highest priority.

                          This new component will be added in the next release, I think 🙂

                          #49654
                          SzakiLaci
                          Participant

                            Version 8.12 is out, (since 2012. dec. 14.) and since 8.11 (2012. dec. 12) there's a new component: TsVirtualImageList

                            COOL ! 🙂 .. I was very happy about it. (first)

                            Today I've finished implementing the new package to my program and figured out the following:

                            Seems to Re-Create every each picture >>

                            – consuming huge amount of memory

                            – making Delphi7 running at 100% process time for half minute after clicking SAVE each time

                            – does not FREE the pictures at program ending >> making to drop Access Violation at the end.

                            To Test it:

                            ADD 50 pictures to a TsAlphImageList (ca. 100Kb each), than Drop a TsVirtualImageList to the Form too, and SET width=256, Height=256.

                            So this way it isn't going to work properly 🙁 because the basic idea was to Re-introducing a FEW pictures here and there from ONE BIG package in different sizes, without need of extra memory and space.

                            My question/recommendation would be :

                            – Isn't it possible to convert those pictures on the fly? I mean it would only show VIRTUALLY as if there would be any real picture, but not holding every each of them in memory pre-converted?

                            ___________

                            Anyway every other component fixes in the last 4 month seems to be PERFECT ! Great Job, Thank you and Marry Christmas !!! 🙂

                            #49655
                            SzakiLaci
                            Participant

                              … if that's not possible, is it maybe a solution to create and convert only THOSE really needed and accessed? (And free after nothing is pointed to it…)

                              #49664
                              Support
                              Keymaster

                                I have changed this component today, added the UseCache property there.

                                Caching is not using and pictures are received directly from base ImageList if UseCache is False.

                                Here you can find a demo : http://www.alphaskins.com/sfiles/demos/virtualimagelist.zip

                                These changes will be available very soon with nearest release.

                                #49665
                                SzakiLaci
                                Participant

                                  Man, seriously … you are my “PROGRAMMER OF THE YEAR” ! :a7:

                                  You have done it again.

                                  The example to test the difference between cached and non-cashed appearance is PERFECT. (And also looks cool…)

                                  You've made my Christmas gift.

                                  _______________

                                  You forced me to “revenge” it by sending you a tiny Christmas donation… see my Private message 😉

                                Viewing 15 posts - 1 through 15 (of 15 total)
                                • You must be logged in to reply to this topic.