Jump to content
FHannes

Resize JPEGs

Recommended Posts

I had to resize a lot of JPEG's to a long edge of 1000 pix and a thumbnail with a long edge of 200pix. If anyone is interested, here's the script I wrote to do it for me:

[scar]var

Files: TStrArray;

Idx, Len: Integer;

Bmp: TSCARBitmap;

NewWidth, NewHeight, ThumbWidth, ThumbHeight: Integer;

 

begin

Files := GetFiles(ScriptPath, 'jpg');

Len := Length(Files);

for Idx := 0 to Len - 1 do

begin

Bmp := TSCARBitmap.Create('');

try

Bmp.LoadFromJpeg(ScriptPath + Files[idx]);

if Bmp.Width > Bmp.Height then

begin

NewWidth := 1000;

NewHeight := Bmp.Height * 1000 div Bmp.Width;

ThumbWidth := 200;

ThumbHeight := Bmp.Height * 200 div Bmp.Width;

end else begin

NewWidth := Bmp.Width * 1000 div Bmp.Height;

NewHeight := 1000;

ThumbWidth := Bmp.Width * 200 div Bmp.Height;

ThumbHeight := 200;

end;

Bmp.Resize(NewWidth, NewHeight);

Bmp.SaveToJpeg(ScriptPath + 'output\' + Copy(Files[idx], 1,

Length(Files[idx]) - Length(ExtractFileExt(Files[idx]))) + '.jpg', 95);

Bmp.Resize(ThumbWidth, ThumbHeight);

Bmp.SaveToJpeg(ScriptPath + 'output\' + Copy(Files[idx], 1,

Length(Files[idx]) - Length(ExtractFileExt(Files[idx]))) + '-thumb.jpg', 95);

finally

Bmp.Free;

end;

Status(IntToStr(Idx + 1) + '/' + IntToStr(Len));

end;

Status('Done');

end.[/scar]

Link to comment
Share on other sites

how to buy bitcoins in iceland crypto coin trading platform coin salary crypto taskrabbit locations ggg games akt price best performing crypto etf gemini crypto currency 5000 bitcoins $ to bitcoin converter bitboy crypto affair which faction gray zone warfare how long it takes to buy bitcoin on cex.io reddit 100 crypto to usd filestar reviews

1 bitcoin en cfa aujourd'hui 1 of bitcoin holders hope to buy bitcoin strongest covalent bond best crypto to by today buy bitcoin with prepaid visa pepe fork pork abnb crypto future price of ripple buy bitcoins with skrill

do i need a digital wallet to buy bitcoin doggecoin shib price prediction 1 cent 0021418 bitcoin to usd 2022 upcoming crypto 2024 crypto bull run price prediction angus brown crypto lockchain.ai when will the bitcoin etf be approved buy products with bitcoin in india

gapro 1 bitcoin kaç tl 2012 ftx bar date buying bitcoin at different prices 100 dolares cuantos bitcoins son tao crypto price prediction mew solana buy.bitcoin red square phmex elon musk giving out bitcoin

2023 crypto tax chime closed my account 0231 bitcoin to usd best crypto backtesting tool acciones de bitcoin hoy
Link to comment
Share on other sites

buy bitcoin fort wayne in dgi crypto banks accepting crypto adin ross crypto shit solana price target can i buy physical bitcoin bang crypto what makes crypto go up or down andrew ng sequoia tapioca dao coincodex how much crypto is taxable 1 bitcoin kaç ethereum 100th/s bitcoin miner calculator how to use crypto

buy brett on base 1000x crypto 2020 review of coinbase crypto futures trading for beginners airdrop cryptocurrency binance monitorship 0.01078544 bitcoin converted to usd bitcoin cash buying suspended ladys crypto prediction trident crypto fund airdrop

neuropathy icd 10 doghecoin do people buy meth with bitcoin tensor crypto crypto telegram marketing $aaa crypto uniwswap binance buy bitcoin with credit card bitcoin trader a cuГЎnto equivale un bitcoin a dГіlar

el salvador president buys bitcoin best crypto wallet aion crypto avis kraken vs crypto.com energitoken buy bitcoin sffcu paxful bitcoin etf holdings buy bitcoin on dark web pulsecgain clock24

vgx coin 00458 bitcoin adam draper bitcoin interview gmee elon coin price prediction 2025
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...