Code Monkey home page Code Monkey logo

Comments (9)

regs01 avatar regs01 commented on May 31, 2024 1

That would be handy indeed. I am also not sure how to make it elegant. The pointer parameter is indeed a way to have it optionally returned.

Another option is a record or object in return of GetThumbnail functions with Bitmap and FileInfo

from bgrabitmap.

regs01 avatar regs01 commented on May 31, 2024 1

And another option for AOptions is public variable in BGRAThumbnail unit, so there will be no need to initialize it and pass it, like those CheckersColor variables. So it will be initialized on initialization with default parameters.

from bgrabitmap.

circular17 avatar circular17 commented on May 31, 2024

Good idea.

There are indeed lots of parameters already and using an enum could help.

from bgrabitmap.

circular17 avatar circular17 commented on May 31, 2024

Would you like the thumbnail image to be smaller or keep it the same size and pad with empty pixels?

from bgrabitmap.

circular17 avatar circular17 commented on May 31, 2024

Something like that?

type
  TBGRAThumbnailOptions = record
    BackColor: TBGRAPixel;  //default background
    Checkers: boolean;      //draw checkers to represent the transparent background of the image
    Enlarge: boolean;       //enlarge source image if smaller than the expected thumbnail size
    Pad: boolean;           //pad the thumbnail with BackColor to make it the expected size
  end; 

from bgrabitmap.

regs01 avatar regs01 commented on May 31, 2024

Not sure what Pad means. Width and Height could be there as well.

Here is early implementation. I moved I moved dimension check to InternalGetBitmapThumbnail, as GetStremThumbnail wouldn't work for all files. All AOptions functions are overload functions located below of original for compatibility with older code.

QuickInfo is not quite implemented. Still thinking around it. May be other way or other record type. Just to optionally return original resolution as well, so can be used alongside thumbnail if needed without additional access to picture file. Will think on this tomorrow.

https://pastebin.com/e6Hvf0pj

from bgrabitmap.

circular17 avatar circular17 commented on May 31, 2024

About Pad, for now it would be set to True. When you ask for a thumbnail of size 128x128, then if the image is 128x64, then there will be unused pixels in the square 128x128 and they will be set to the BackColor. In other word the content is padded with this color.

But as you ask for images not to be enlarged, then you might for example just want to reduce the resolution, but not pad it with pixels. If the source image is 256x128, it would become 128x64 and not 128x128.

I moved I moved dimension check to InternalGetBitmapThumbnail, as GetStremThumbnail wouldn't work for all files.

I am not sure I understand

All AOptions functions are overload functions located below of original for compatibility with older code.

I agree that overload is a way to preserve compatibility. The functions that contains the actual code will be those that have the AOptions parameter, while the others functions will call the former. So that code is not duplicated and that all options are handled.

QuickInfo is not quite implemented. Still thinking around it. May be other way or other record type. Just to optionally return original resolution as well, so can be used alongside thumbnail if needed without additional access to picture file. Will think on this tomorrow.

That would be handy indeed. I am also not sure how to make it elegant. The pointer parameter is indeed a way to have it optionally returned.

from bgrabitmap.

regs01 avatar regs01 commented on May 31, 2024

I am not sure I understand

if AOptions.Enlarge = False section is in InternalGetBitmapThumbnail, rather than GetStreamThumbnail, as I was suggesting above, as not not every AReader is TBGRAImageReader

from bgrabitmap.

circular17 avatar circular17 commented on May 31, 2024

if AOptions.Enlarge = False section is in InternalGetBitmapThumbnail, rather than GetStreamThumbnail, as I was suggesting above, as not not every AReader is TBGRAImageReader

Not sure I see why. Enlarging can be done on any format.

from bgrabitmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.