• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 
21 November 2024, 18:33:21

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - davem

1
Ok, diky.
2
Help & Questions / Size of ImagingCanvas?
24 May 2012, 11:23:39
Hi
is it possible to find out the width and height of an ImagingCanvas?

And second question - if I want to create a visual effect on an image with partial transparency (for example the corners fading to black or white), what approach do you suggest? I assume merging two images somehow?

And last question - what is the difference between DrawAlpha and DrawBlend?

   Thanks, David
3
Help & Questions / JPG Resolution
1 November 2011, 11:44:59
Do I understand from this topic http://galfar.vevb.net/imaging/smf/index.php/topic,283.0.html that the library supports the print resolution of JPEGs (in pixels per inch or pixels per cm)? How to set it up? Thanks!
4
Bugs And Other Insects / Two small bugs
1 November 2011, 11:09:25
  Hi,
  I have just installed the latest working version and found two small issues on delphi 2009 / Win 7 (they raise errors during compilation):

ImagingUtility.pas ([DCC Error] ImagingUtility.pas(1529): E2003 Undeclared identifier: 'Result')
Code (delphi) Select

{$IF Defined(DELPHI)}
  {$IF CompilerVersion >= 23}
  FloatFormatSettings := TFormatSettings.Create('en-US');
  {$ELSE}
  // FloatFormatSettings := GetLocaleFormatSettings(1033, Result);  // 1.11.2011
   GetLocaleFormatSettings(1033, FloatFormatSettings);
  {$IFEND}
{$ELSE FPC}
  FloatFormatSettings := DefaultFormatSettings;
  FloatFormatSettings.DecimalSeparator := '.';
{$IFEND}


ImagingRadiance.pas ([DCC Error] ImagingRadiance.pas(359): E2033 Types of actual and formal var parameters must be identical)
Code (delphi) Select

  procedure EncodeRgbe(const Src: TColor96FPRec; var Dest: TRgbe); {$IFDEF USE_INLINE}inline;{$ENDIF}
  var
    V, M: Extended; // {$IFDEF FPC}Float{$ELSE}Single{$ENDIF}; // 1.11.2011
..
      Frexp(V, M, E);     // 1.11.2011, here it used to report the error for M variable (


In both cases I did a correction, hopefully they are fine (see my comment 1.11.2011)

Apart from that I also get this warning: [DCC Hint] ImagingRadiance.pas(366): H2445 Inline function 'ClampToByte' has not been expanded because its unit 'ImagingUtility' is specified in USES statement of IMPLEMENTATION section and current function is inline function or being inline function

5
Ok, understood, but I haven't seen anywhere that there is a newer unreleased version of the code then the latest released one. Maybe it is writtent somewhere on your pages but I simply haven't noticed. Anyway, now it is solved and I will keep on updating with the new source codes. Thanks again!
6
Ah, thanks, it works fine!
Why the newest version is over 1 year old if there are so many corrections and improvements?

  Cheers, David
7
Bugs And Other Insects / Freeze on loading a JPG
26 November 2010, 11:25:07
  Hi,
  I got two examples of JPG files that make the loading freeze. They are corrupt however the library should not freeze and rather return an error or load the image incomplete (like Windows preview does). I use version 0.264. Can you help me please?

Delphi 2009
Win 7 64bit, Win XP

  Thanks, David

Ps: I sent a small donation today  ;)
8
Appologies, mea culpa, respectively, culpa of other library I use. Vampyre is perfect as always!
9
Please do not take any actions yet, I am still investigating, it might be a problem between my chair and keyboard.  :)
10
  Hi,
  I got a weird problem. When saving JPG, the saved file has about double the size in comparison with other programs. I tried the "standard" TJpegImage and Paint Shop Pro and both save about the same file size (with the same image source, same resolution of output, same quality and progressive flag on). When saving the same using vampyre, I have to set quality to about 70 to produce a file with comparable size but then the image is obviously ugly. Any idea??

   Thank you, David
11
Help & Questions / Re: Quality of resizing
20 April 2010, 16:11:25
Quote from: Galfar on 20 April 2010, 16:06:48
Thanks for locating the problem. I probably remove the "optimized" code path altogether, that's not the first problem with it and it's only marginally faster anyway.


I agree, the difference is very small. That's actually the same what I did in the end.
12
Quote from: Galfar on 20 April 2010, 15:33:20
What about calling Canvas.Release or Canvas.Refresh after the pixels are set?


Canvas.Refresh did not help. I haven't tried Canvas.Release.
13
Help & Questions / Re: Quality of resizing
20 April 2010, 11:33:47
I ask, I answer. I like this forum.  :-)

Anyway, I found a problem in function StretchResample (ImagingFormats.pas). This function rounds the Weights which speeds up the process a bit but produces the ugly rectangles in the result. I tried to modify the function and it seems the result is much better now. Please consider implementing this into the next version of the library. Changed lines are marked with "DMA".


var  IWeightR, IAccumAR, IAccumRR, IAccumGR, IAccumBR : single;
...
      for J := 0 to DstHeight - 1 do
      begin
        ClusterY := MapY[J];
        for X := XMinimum to XMaximum do
        begin
          IAccumAR := 0.0;    // DMA
          IAccumRR := 0.0;    // DMA
          IAccumGR := 0.0;    // DMA
          IAccumBR := 0.0;    // DMA
          for Y := 0 to Length(ClusterY) - 1 do
          begin
            // IWeight := Round(256 * ClusterY[Y].Weight);  // DMA - do not use
            IWeightR:= 256*ClusterY[Y].Weight;      // DMA, remove rounding
            CopyPixel(
              @PByteArray(SrcImage.Bits)[(ClusterY[Y].Pos * SrcImage.Width + X) * Info.BytesPerPixel],
              @SrcColor, Info.BytesPerPixel);

            IAccumBR := IAccumBR + SrcColor.B * IWeightR;   // DMA, use single instead of integer
            IAccumGR := IAccumGR + SrcColor.G * IWeightR;   // DMA, use single instead of integer
            IAccumRR := IAccumRR + SrcColor.R * IWeightR;   // DMA, use single instead of integer
            IAccumAR := IAccumAR + SrcColor.A * IWeightR;   // DMA, use single instead of integer
          end;
          with LineBufferInt[X - XMinimum] do
          begin
            A := round(IAccumAR); // DMA, round single
            R := round (IAccumRR);// DMA, round single
            G := round (IAccumGR);// DMA, round single
            B := round (IAccumBR);// DMA, round single
          end;
        end;

        DstLine := @PByteArray(DstImage.Bits)[((J + DstY) * DstImage.Width + DstX)* Info.BytesPerPixel];

        for I := 0 to DstWidth - 1 do
        begin
          ClusterX := MapX[I];
          IAccumAR := 0.0;    // DMA, use single
          IAccumRR := 0.0;    // DMA, use single
          IAccumGR := 0.0;    // DMA, use single
          IAccumBR := 0.0;    // DMA, use single
          for X := 0 to Length(ClusterX) - 1 do
          begin
            // IWeight := Round(256 * ClusterX[X].Weight);  // DMA - do not use anymore
            IWeightR:= 256*ClusterX[X].Weight;      // DMA, use single, do not round
            with LineBufferInt[ClusterX[X].Pos - XMinimum] do
            begin
              IAccumBR := IAccumBR + B * IWeightR;    // DMA
              IAccumGR := IAccumGR + G * IWeightR;    // DMA
              IAccumRR := IAccumRR + R * IWeightR;    // DMA
              IAccumAR := IAccumAR + A * IWeightR;    // DMA
            end;
          end;

          SrcColor.B := ClampInt(round(IAccumBR), 0, $00FF0000) shr 16; // DMA, added round on single
          SrcColor.G := ClampInt(round(IAccumGR), 0, $00FF0000) shr 16; // DMA, added round on single
          SrcColor.R := ClampInt(round(IAccumRR), 0, $00FF0000) shr 16; // DMA, added round on single
          SrcColor.A := ClampInt(round(IAccumAR), 0, $00FF0000) shr 16; // DMA, added round on single

          CopyPixel(@SrcColor, DstLine, Info.BytesPerPixel);
          Inc(DstLine, Info.BytesPerPixel);
        end;
      end;


By the way, it seems that the whole problem is in the "optimized" version, the "not optimized one" seems to work well.
14
Hmm, Synchronize seems to solve the issue. But I don't know why.  :-\
15
  I got very interesting problem. I manipulate an image using TImageData however then I need to add a text and modify a few pixels manually. So I do this:

        ImgBitmap:=TImagingBitmap.Create;
        ImgBitmap.AssignFromImageData(MainImage);

        // add text (just an example)
        ImgBitmap.Canvas.TextOut(x,y,'some text');

        // set some colors (just an example)
        ImgBitmap.Canvas.Pixels[x,y]:=col;

        // save the changes back to ImageData
        ImgBitmap.AssignToImageData(MainImage);
        ImgBitmap.Free;

  However, my problem is that in some cases (let's say every fifth case) the changes of colors are not visible on the picture when I save it. It seems to me that the Canvas/Handle hasn't been updated yet at the moment I assign the bitmap back to ImageData. Sometimes the part of the image is even partially black. Does anyone have any idea what can be done? I tried to put sleep behind, I tried to use a CriticalSection (it is multithreading appl), I tried to Lock the canvas (although the ImgBitmap is not shared) however nothing works. I also tried to run only one thread but it was the same. Does anyone have any idea?
SMF spam blocked by CleanTalk