Solved

Compression of pictures

Posted on 2000-03-11
5
236 Views
Last Modified: 2010-04-04
when i press printScreen and then go to my program and paste the picture in the clipboard in a DBImage, and save this picturem, i found that this picture takes a large storge capicity, because it's a BMP file in the clipboard,,, What i Want is to paste the picture in the clipboard in the DBImage , but as JPG or GIF format.

Simple Code or Headlines is Preferable.

Thank you all.
0
Comment
Question by:ams4380361
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:sunsetyang
ID: 2609108
If You are using Delphi 4 or above,you can simply do it.Delphi 4 includes a unit called jpeg,with this unit ,you can use jpg support in your program.Simply add one statement in the uses clause:jpeg.
 You can use jpeg as below:
 var:
   myjpeg:TJpegImage;
 begin
  ...
  myjpeg:=TJpegImage.Create;
  //myjpeg property setting
  //After you get the image you want to save,you can assign the bitmap to the myjpeg
  mybitmap.assign(myjpeg.graphic);
  myjpeg.compress;
  myjpeg.savetofile('filename.jpg');
  ...
  To gif,you can reference the GIF format document and to build a unit yourself.Or to serach for the right unit.
 
 
0
 

Author Comment

by:ams4380361
ID: 2609113
in fact i am using Delphi 3.0, and your method is not pasting the picture from the clipboard to dbimage directly.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2609581
hi ams4380361,
what database do you use?
meikl
0
 
LVL 15

Expert Comment

by:simonet
ID: 2610370
Following...
0
 
LVL 1

Accepted Solution

by:
saulite earned 50 total points
ID: 2788110
use JPEG unit. When you press Print-Screen, image in memory is a bitmap. You can read it from clipboard, and convert it to JPG.

uses {...}, jpeg

{...}


procedure TForm1.SaveClipboardToJPEG(Sender: TObject);
var
  Jpeg1: TJpegImage;
begin
 if Clipboard.HasFormat(CF_BITMAP) then
 begin
   Jpeg1:=TJpegImage.Create;
   Jpeg1.Assign(Clipboard);
   Jpeg1.CompressionQuality:=75;  //quality for compressing 1..100
   Jpeg1.Compress;
   Jpeg1.SvaeToFile('Clipboard.jpg');
 end;
end;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 124
Dev Express grid collapse 2 55
drawing animated level bar based on numbers 3 122
Tviruailstringtree sort multi columns on header click 1 96
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question