× CodeTyphon MacOS Development, discussions and problems

Question CT 7.3 Big Sur JPEG issue

  • Denis D
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 week ago - 9 months 1 week ago #15473 by Denis D
CT 7.3 Big Sur JPEG issue was created by Denis D
Hi,
Thanks for your great job. I just installed CT 7.3 on Mac/intel Big Sur 11.1 and I have issues trying to save (using bgrabitmap) or load in a memorystream a jpeg image :
The error message is : 'DCT coefficient out of range'.
Any idea ?
Thanks a lot, regards.
Last edit: 9 months 1 week ago by Denis D.

Please Log in or Create an account to join the conversation.

More
9 months 1 week ago - 9 months 1 week ago #15476 by Matis A.
Replied by Matis A. on topic CT 7.3 Big Sur JPEG issue
A sample project to test ?

PilotLogic Core Programmer
Last edit: 9 months 1 week ago by Matis A..

Please Log in or Create an account to join the conversation.

  • Denis D
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 week ago #15477 by Denis D
Replied by Denis D on topic CT 7.3 Big Sur JPEG issue
Try this simple code in console app:

Uses

... bgrabitmap, ...


procedure test;
var
abgra:tbgrabitmap;
begin
abgra:=tbgrabitmap.create;
abgra.loadfromfile('afile.png');
abgra.savetofile('afile.jpg');
abgra.free
end;

This creates the error ; I supect an issue with either the libjpeg (the error is within the libjpeg code), or the handling of this libjpeg by freepascal...

Thanks
 

Please Log in or Create an account to join the conversation.

  • Denis D
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 week ago #15490 by Denis D
Replied by Denis D on topic CT 7.3 Big Sur JPEG issue
I also tried using CT 7.3 on MacOSX Catalina ; same bug : DCT coefficient out of range.

Either Free Pascal error, or something else...
Free Pascal version used in CT 7.3 is 3.3.1 ; is it possible to install another FP version (3.2 e.g.), and if yes, how ?
Thanks, regards.

Please Log in or Create an account to join the conversation.

More
9 months 1 week ago - 9 months 1 week ago #15492 by Matis A.
Replied by Matis A. on topic CT 7.3 Big Sur JPEG issue
NO you can't install other FPC
ctFPC is NOT the same with "Vanilla FPC".

Your source code is corrects ?
TbgraBitmap work at MacOS ?

Please try to post the above problem at BGRAbitmap support here

PilotLogic Core Programmer
Last edit: 9 months 1 week ago by Matis A..

Please Log in or Create an account to join the conversation.

  • Denis D
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 months 1 week ago #15495 by Denis D
Replied by Denis D on topic CT 7.3 Big Sur JPEG issue
Thanks, but the problem is the same with TFPwriterJPEG, so I think it's not a TBGRABitmap issue, but a Free Pascal issue, or something else related to FP because this code is working on CT 7.0 and no working on CT 7.3 (error "DCT coefficient out of range") :

uses
FPimage,
  FPReadPNG, FPReadBMP, FPReadGif,
  FPWriteJPEG

function ConvertImage(ImgFile:string):Tmemorystream;
var
  ir: TFPCustomImageReader;
  jw: TFPWriterJPEG;
  im: TFPMemoryImage;
  ex:string;
begin
  ex := StringReplace(UpperCase(ExtractFileExt(imgFile)), '.', '', [rfReplaceAll]);
  if (ex = '') then
    Error('File without an extension!');
  try
    if (ex = 'PNG') then
      ir := TFPReaderPNG.Create
    else
    if ((ex = 'JPG') or (ex = 'JPEG')) then
      ir := TFPReaderJPEG.Create
    else
    if (ex = 'BMP') then
      ir := TFPReaderBMP.Create
    else
    if (ex = 'GIF') then
      ir := TFPReaderGif.Create
    else
      Error('Invalid extension from image: ' + ex);
    im := TFPMemoryImage.Create(0, 0);
    jw := TFPWriterJPEG.Create;
    im.LoadFromFile(imgFile, ir);
    Result := TMemoryStream.Create;
    im.SaveToStream(Result, jw);   
  finally
    ir.Free;
    im.Free;
    jw.Free;
  end;
end;

Please Log in or Create an account to join the conversation.