if Clipboard.HasFormat (CF_PICTURE) then
begin
bitmap := TBitmap.Create;
png := TPNGImage.Create;
try
bitmap.Assign(Clipboard);
bitmap.SaveToFile(ExtractFilePath(application.ExeName) +'ilename.bmp');
png.Draw(bitmap.Canvas, Rect(0, 0, bitmap.Width, bitmap.Height));
png.SaveToFile(extractfilepath(application.ExeName) +'ilename.png');
finally
bitmap.free;
png.free;
end;
end;
Although the conversion to bmp works, I can even open it in mspaint and view its content, the conversion to png fails, and I have a blank png image. What am I doing wrong?
However, it is easier to do a simple task:
png.Assign(Bitmap);
div>
I have the following simple code to convert a clipboard image to bmp and then to png:
if Clipboard.HasFormat(CF_PICTURE ) then
begin
bitmap := TBitmap.Create;
png := TPNGImage.Create;
try
bitmap.Assign(Clipboard);
bitmap .SaveToFile(ExtractFilePath(application.ExeName) +'ilename.bmp');
png.Draw(bitmap.Canvas, Rect(0, 0, bitmap.Width, bitmap.Height));
png.SaveToFile(extractfilepath(application.ExeName) +'ilename.png');
finally
bitmap.free;
png.free;
end;
end;
Although the conversion to bmp works, I can even open it in mspaint and view its content, the conversion to png fails, and I have a blank png image. What am I doing wrong?
You have not set the size (height and width) of the PNG image object. You need to do this before drawing.
However, it is easier to do a simple task:
png.Assign(Bitmap);
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3141 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC