Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:41:27+00:00 2026-05-30T12:41:27+00:00

I try to load an image in imgQInput (which is a TImage), assign it

  • 0

I try to load an image in imgQInput (which is a TImage), assign it to a TJpegImage, compress it (compression factor 5) and show it in imgQOutput (another TImage). But it doesn’t work. The image in imgQOutput is the same as the original. It should look VERY pixelated because of the compression factor! The compression works however, because when I save the JPEG to disk it is really small.

  JPG:= TJPEGImage.Create;
   TRY
     JPG.CompressionQuality:= trkQuality.Position;
     JPG.Assign(imgQInput.Picture.Graphic);
     CompressJpeg(JPG);
     imgQOutput.Picture.Assign(JPG);          <--------- something wrong here. the shown image is not the compressed image but the original one
   FINALLY
     FreeAndNil(JPG);
   END;


function CompressJpeg(OutJPG: TJPEGImage): Integer;
VAR tmpQStream: TMemoryStream;
begin
 tmpQStream:= TMemoryStream.Create;
 TRY
   OutJPG.Compress;
   OutJPG.SaveToStream(tmpQStream);
   OutJPG.SaveToFile('c:\CompTest.jpg');       <--------------- this works
   Result:= tmpQStream.Size;
 FINALLY
   FreeAndNil(tmpQStream);
 END;
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:41:28+00:00Added an answer on May 30, 2026 at 12:41 pm

    You did not used the compressed JPG at all.

    Change CompressJpeg as followings:

    function CompressJpeg(OutJPG: TJPEGImage): Integer;
    VAR tmpQStream: TMemoryStream;
    begin
     tmpQStream:= TMemoryStream.Create;
     TRY
       OutJPG.Compress;
       OutJPG.SaveToStream(tmpQStream);
       OutJPG.SaveToFile('c:\CompTest.jpg');    // You can remove this line.
       tmpQStream.Position := 0;                //
       OutJPG.LoadFromStream(tmpQStream);       // Reload the jpeg stream to OutJPG
       Result:= tmpQStream.Size;
     FINALLY
       FreeAndNil(tmpQStream);
     END;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that when I try to load a resource (an image, data, sound
When i try to load an image into android it gives me the following
I try to load image with processing.js using CoffeeScript and write this simple code:
I have a singleton, that is an image manager. When I try to load
I load image from url. it' ok, but when long time it error outofmemory:
I am trying to load an image from a server to show it in
Crontab always try to load mysql-python image from my home directory, while the library
I want to load image runtime in my activity but it is load in
I am using xml.net in web application When I try load xml through an
When I try to load a solution in Visual Studio 2008, it immediately closes.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.