Solved

Compression of pictures

Posted on 2000-03-11
5
231 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 83
code issue 8 100
Connection between libmysql.dll and MySQL Versions 7 87
Intraweb download file link ? 1 110
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now