Solved

Compression of pictures

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

Technology Partners: 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
Internet Explorer View Settings Question 15 123
tvirtualstringtree freeze when load too manny images 10 80
Delphi, TImage, Png 2 23
Get weeknumber and year from date 4 27
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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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