Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Change an image PPM (DPI) via Clipboard

Avatar of Member_2_5194534
Member_2_5194534 asked on
DelphiEditors IDEs
1 Comment1 Solution1483 ViewsLast Modified:
I found this function that changes an image PPM (Pels Per Meter) but I was wondering if it's possible to do it via clipboard.


procedure ChangeBitmapDPI(const InputFileName: string; DPI: Integer);
var
PelsPerMeter: Integer;
fs: TFileStream;
begin
if DPI = 0 then DPI := 96; // normal screen resolution, in lack of better value.
PelsPerMeter := Round(DPI / 2.54 * 100); // convert DPI to DPM (dots per inch -> dots per meter)
fs := TFileStream.Create(InputFileName, fmOpenReadWrite or fmShareDenyNone);
try
fs.Position := 38; // biXPelsPerMeter, 4 bytes, X-resolution, Pixels per meter
fs.WriteBuffer(PelsPerMeter, 4);
fs.Position := 42; // biYPelsPerMeter, 4 bytes, Y-resolution, Pixels per meter
fs.WriteBuffer(PelsPerMeter, 4);
finally
fs.Free;
end;
end;
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio AccalaiFlag of Italy imageDeveloper

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers