Howto resize multiple pictures, graphics, images
for k in $(ls *.jpg); do convert -resize 800 -quality 80 $k r800-$k; done
11321 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
for k in $(ls *.jpg); do convert -resize 800 -quality 80 $k r800-$k; done
for img in $(ls *.png); do convert $img -resize 75% smaller-$img; done;
public void ResizeImage(string OriginalFile, string NewFile, int NewWidth, int MaxHeight, bool OnlyResizeIfWider) { System.Drawing.Image FullsizeImage = System.Drawing.Image.FromFile(OriginalFile); // Prevent using images internal thumbnail FullsizeImage.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone); FullsizeImage.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone); if (OnlyResizeIfWider) { if (FullsizeImage.Width <= NewWidth) { NewWidth = FullsizeImage.Width; } } int NewHeight = FullsizeImage.Height * NewWidth / FullsizeImage.Width; if (NewHeight > MaxHeight) { // Resize with height instead NewWidth = FullsizeImage.Width * MaxHeight / FullsizeImage.Height; NewHeight = MaxHeight; } System.Drawing.Image NewImage = FullsizeImage.GetThumbnailImage(NewWidth, NewHeight, null, IntPtr.Zero); // Clear handle to original file so that we can overwrite it if necessary FullsizeImage.Dispose(); // Save resized picture NewImage.Save(NewFile); }
app.body = c = Canvas() w,h = 20,20 im = Image.new(size=(w,h)) # here's prototype # blit(im, source=(0,0,w,h), target=(0,0), mask=None, scale=0) # here are examples c.blit(im) # put entire image on top-left c.blit(im, target=(70,70)) # put it about mid-screen c.blit(im, (0,0,w/2,h/2)) # put a quater image on top-left # double the image size and put it about mid-screen c.blit(im, target=(60,60,100,100), scale=1)
mask = Image.new((w,h),'1')
body, td {font:90% Tahoma, [other fonts]}
<body> <script src="http://www.walterzorn.com/scripts/wz_dragdrop.js"></script> <img name="name1" src="someImg.jpg" width=240 height=135> <script>SET_DHTML("name1")</script> </body>
SET_DHTML("name1"+RESIZABLE) // any size SET_DHTML("name1"+SCALABLE) // keep aspect ratio