Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Compression of pictures

Posted on 2000-03-11
5
Medium Priority
?
238 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 150 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

721 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