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 8095923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:17:58+00:00 2026-06-05T21:17:58+00:00

I got an app that loads images into the Zimage(graphcontrol). One issue I am

  • 0

I got an app that loads images into the Zimage(graphcontrol). One issue I am having is the original image is a lot better quality than the one that ends up showing in the component. The one showing looks like it has random black marks on it. So what i do:

  • load image from folder into TJpegimage
  • assign jpg to a bitmap
  • save bitmap to object list
  • repeat that above until all images are loaded into object list

  • Then i create a bitmap

  • assign first image in object list to it
  • draw the bitmap on canvas.

but it just looks a lot worse than the original. Any help or idea on this?

This is the loading code.

    procedure TForm1.LoadImages(const Dir: string);
var
  i: Integer;
  CurFileName: string;
  JpgIn: TJPEGImage;
  BmpOut: TBitmap;
begin

//set up progress bar
 progressbar1.Min := 0;
 progressbar1.Max := GetFilesCount(dir,'*.*');
 Label3.Visible := true;
 progressbar1.Visible := true;
//sets array for length
  SetLength(hwArray,GetFilesCount(dir,'*.*'));
//sets index for object list
  CurIdx := -1;
  i := 0;
  while True do
  begin
//gets file name out of current folder
    CurFileName := Format('%s%d.jpg',
                          [IncludeTrailingPathDelimiter(Dir), i]);
    if not FileExists(CurFileName) then
      Break;
//count files in folder for progress bar.
     progressbar1.StepBy(1);
//creates jpgin
    JpgIn := TJPEGImage.Create;
    try
//loads jpgin with file
      JpgIn.LoadFromFile(CurFileName);
//creates TBitmap and sets width to same as jpgs
      BmpOut := TBitmap.Create;
      bmpout.Width := jpgin.Width;
      bmpout.Height := jpgin.Height;
     try
         BmpOut.Assign(JpgIn);
//adds 1 to index for object list. thus starting at 0
         curIdx := curIdx+1;
//add bitmap to objectlist
         CurIdx:= mylist.Add(TBitmap(bmpout));
         hwArray[CurIdx][0]:=jpgin.Width;
         hwArray[CurIdx][1]:=jpgin.height;

      finally
      end;
    finally
      JpgIn.Free;
    end;
    Inc(i);
  end;
//makes sure cout is above 0 thus files added
  if mylist.Count > 0 then
  begin
      try
      CurIdx := 0;
      getBitmapfromList(CurIdx,bmpout);
      ZImage1.Bitmap.Assign(bmpout);
       //image1.Canvas.Assign(bmpout);
    finally
       BmpOut.Free;
    end;
  end;
  Label3.Visible := false;
  progressbar1.Visible := false;
  page:= '0';
  zimage1.DblClick;
end;

function get bit map from list

procedure Tform1.getBitmapfromList(index:integer;var Bitm:TBitmap);
begin
     Bitm.Assign(TBitmap(mylist[index]));
     if (Bitm.Width<>hwArray[index][0]) OR (Bitm.Height<>hwArray[index][1]) then begin
        ShowMessage('Size differs');
        Bitm.Width:=hwArray[index][0];
        Bitm.Height:=hwArray[index][1];
     end;
end;

Next button to view next image

procedure TForm1.Button3Click(Sender: TObject);
var
  BmpOut: TBitmap;
begin
bmpout := TBitmap.Create;
CurIdx:= strtoint(page);
getBitmapfromList(CurIdx,bmpout);
ZImage1.Bitmap.Assign(bmpout);
//image1.Canvas.Assign(bmpout);
page := inttostr(strtoint(page) +1);      //this should show next item in ilst?
zimage1.Repaint;
end;

Thanks for any help or suggestions.

Here are the images:

http://s7.postimage.org/48mectvsp/image_Difference.png

EDIT

It seems like once i zoom in on an image it gets better. the worst quility is when its full screen/zoomed all the way out.. original size.

  • 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-06-05T21:18:00+00:00Added an answer on June 5, 2026 at 9:18 pm
    • a) I assume that all images have a different size. If the displayed image “ZImage1” should have always the same height or width (one of two things, or it is made ​​with stretch fit == low quality) must be determined ratio (orginal.height / original.width).Then “ZImage1” (either height or width) must calculated in the new relationship.
    • b) Set ZImage1.AutoSize:=false;
    • c) Set ZImage1.Stretch:=false;

    • d) bmpout.Width and Height must set to the current mylist[CurIdx] size.

    bmpout.Assign(TBitmap(mylist[CurIdx]));
    Zimage1.Bitmap.Width := bmpout.Width;
    Zimage1.Bitmap.Height := bmpout.Height;
    ZImage1.Bitmap.Assign(bmpout);
    

    NOTE:

    You did NOT *assign* to mylist .. you store it CurIdx:= mylist.Add(TBitmap(bmpout));

    I can not see how you have created “mylist”.

    Maybe that’s the reason, if you want it back with bmpout.Assign(TBitmap(mylist[CurIdx]));, perhaps there is no automatic set bmpout.Width and bmpout.Height.

    TIP:

    create an extra array to store height and width.

    ....
    JpgIn.LoadFromFile(CurFileName);
    BmpOut := TBitmap.Create;
    bmpout.Width := jpgin.Width;
    bmpout.Height := jpgin.Height;
    ....
    CurIdx:= mylist.Add(TBitmap(bmpout));
    hwArray[CurIdx][0]:=jpgin.Width;
    hwArray[CurIdx][1]:=jpgin.height;
    ....
    

    make a procedure
    EDIT: put a test into it;

    procedure getBitmapfromList(index:integer;var Bitm:TBitmap);
    begin
         Bitm.Assign(TBitmap(mylist[index]));
         if (Bitm.Width<>hwArray[index][0]) OR (Bitm.Height<>hwArray[index][1]) then begin
            ShowMessage('Size differs');
            Bitm.Width:=hwArray[index][0];
            Bitm.Height:=hwArray[index][1];
         end;
    end;
    

    call it with:

    ....
    getBitmapfromList(CurIdx,bmpout);
    ....
    ZImage1.Bitmap.Assign(bmpout);
    ....  
    

    EDIT: Create hwArray

    type
      Tarray2size = Array[0..1] of integer;
    .... 
    
    var
      hwArray : Array of Tarray2size;
    ....
    
    procedure TForm1.LoadImages(const Dir: string);
    ....
    begin
     //set up progress bar
     progressbar1.Min := 0;
     showmessage(inttostr(GetFilesCount(dir,'*.*')));
     SetLength(hwArray,GetFilesCount(dir,'*.*'));
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a console app that loads up a datatable; I'd like to export
I've got an app that exports an AVMutableComposition into a .mov file, and I'd
I've got an app that is heavily based on remote images. They are usually
I made a web app that loads images using jquery, ajax and json. I
I'm developing an app that use a lot of images, I'm using the UIWebView
I've got a sencha touch app, with a panel that contains 3 image buttons,
I got an Activity that when it starts, it loads an image from the
I've got an issue similar to this one: iPad/iPhone browser crashing when loading images
I've got an app that turns some XAML Usercontrols into PNGs - this has
We've got a menu in out web app that uses <a> tags to load

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.