GithubHelp home page GithubHelp logo

tqoiimage's Introduction

TQoiImage

Delphi support for QOI images.

QOI - The “Quite OK Image Format” for fast, lossless image compression
https://github.com/phoboslab/qoi

Example:


uses Forms, Graphics, QoiImage;

type
  TForm1 = class(TForm)
    ...
    image: TImage;
    ...

procedure TForm1.FormCreate(Sender: TObject);
begin
  Image1.Picture.LoadFromFile('.\dice.qoi');
end;

QoiShellExtensions.dll

Windows Explorer (64bit) Preview Handler and Thumbnail Provider shell extensions.

previewhandler

thumbnails

tqoiimage's People

Contributors

angusjohnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tqoiimage's Issues

Bug in opaque QOI test images

Hello @AngusJohnson . Thank you for your great collection of QOI test images. I found your collection from the link you shared at the QOI repo:

phoboslab/qoi#132

I believe there is a bug in the 24-bpp QOI files in your collection.

For example, all QOI images in the /textures_photo folder issue their first pixel using the QOI_OP_RGBA code. This should probably be QOI_OP_RGB (because the images are opaque, and the spec requires starting with alpha = 255 as the "previous pixel value" anyway), but the more serious problem is that the 4-bytes issued in that first QOI_OP_RGBA include an alpha value of zero!

Because this is the only QOI_OP_RGBA issued in these images, the "last pixel seen" alpha value will remain at 0 for the remainder of the decode, rendering the entire image transparent.

Two simple fixes come to mind...

  1. Start opaque images with QOI_OP_RGB instead of QOI_OP_RGBA, or...
  2. If starting an opaque image with QOI_OP_RGBA, ensure the initial alpha value is stored as 255 instead of 0

Yes, a decoder could hypothetically check the number of channels in the QOI header and ignore alpha if 3 channels is listed, but I think this is not ideal as the QOI spec states:

"The colorspace and channel fields are purely informative. They do not change the way data chunks are encoded."

...So it's probably not ideal to assume a decoder would use header channel count to override QOI_OP_RGBA data found in the file.

Thank you for investigating!

Questions and little issues for TQoiImage on Delphi XE2

Hi Angus,

Thank you very much for your work on TQoiImage and Image32.
I have tried your TQoiImage project and the example program on Delphi XE2 and could get it to work with little effort.
There were a few things I had to adjust.

  1. Once in The Vcl.Imaging.QOI.pas and once in Unit1.pas you create a bitmap with a width and height argument.
    Result := TBitmap.Create(img.Width, img.Height);
    This did not work on XE2 and I replaced it with:
  Result := TBitmap.Create;
  Result.Width := img.Width;
  Result.Height := img.Height;

It is an idea to have this updated in the source, for better backward compatibility?

  1. XE2 did not accept
    class function CanLoadFromStream(Stream: TStream): Boolean; override;
    I guess the function doesn't exist yet in XE2 in the base class so there's nothing to override. By quoting away the override I could compile and get a working result. Maybe it's an idea to make the override conditional.
    Although my solution seems to work I wonder: Do you think of any possible problem for this?

  2. I had to quote away
    Vcl.Imaging.Utils in 'Vcl.Imaging.Utils.pas';
    in the main program. It seemed not necessary, and I couldn't find it anywhere (both on XE2 and 10.4). Could you tell me whether that is a good idea, or where I can get it?

Again, thanks very much for your work.

Best regards, JP.

Minor bugs

I'm just flagging that I'm aware of a couple of bugs .. inverted images and color runs at the end of images aren't being filled.
Both these have been fixed but the upload won't happen for about 10hrs (while I sleep).

StopWatch

Add your StopWatch to source
D10.2.3

Code parallel

In qoi encoding and decoding code,
it is better not to use scanline function, best use address pointer,
so that the code is easy to parallelize.
You can't parallelize with the scanline function.

Cross platform

Qoi encoding and decoding itself can be cross platform. If you package it like this, it can only be used under windows.
It is recommended that qoi encoding and decoding be independent and cross platform. Then write VCL / FMX package.

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.