Jump to content


Snap good quality screenshots in LDD


  • Please log in to reply
32 replies to this topic

#26 Brickdoctor

Brickdoctor

  • Look at my Post Count!


    Posts: 21548
    Joined: 06-June 10
    Member: 11254
    Country: California, USA

Posted 26 October 2012 - 08:48 AM

View PostCalabar, on 12 October 2012 - 12:06 PM, said:

Is there anyone who knows if is there a software for mac than can provide batch resize and smart crop?
I just noticed this.

You can use Preview to do batch resize. Drag to select or hold down Command to select multiple images in Finder or on the desktop. Double-click any of the selected images to open in Preview. In the list of images in Preview's right side panel, hold down Command while clicking to select multiple images. (or use Command+A to select them all) Then use the same procedure you would to resize a single image in Preview.

I can provide screenshots if you want them.

#27 Calabar

Calabar

    Posts: 2365
    Joined: 11-April 10
    Member: 10232
    Country: Italy

Posted 26 October 2012 - 09:35 AM

I'm trying to find a way to automatize "crop and resize" functions.
What I'd like to obtain is a simple procedure (could be even a "copy a file and double click on it") that take in input the original images from LDD and generate ready thumbnails.

For windows I'm working with Irfanview, but it seems I've some problem with transparency.
For MAC, I don't know if there is a free software that can achieve this goal.
The procedure you listed above don't have a smart crop function, than it is not what I'm looking for.
"Official LEGO Sets made in LDD" topic: Read guidelines before posting!

#28 Gnac

Gnac

    Posts: 389
    Joined: 05-August 12
    Member: 30056
    Country: England

Posted 01 November 2012 - 09:57 AM

Probably a long shot, since the setup isn't common, but if you have webserver software installed with PHP and Imagick, this script will process a directory of images by removing empty borders and resizing to a default size, or one specified by a query string (e.g. resize.php?size=256).

<?php

	if (isset ($_GET['size']) && is_int ($_GET['size']) )
	{ define ('SET_THUMB_SIZE',	$_GET['size']); }
	else
	{ define ('SET_THUMB_SIZE',	'512'); }

	define ('DIR_PREVIEWS',	SET_THUMB_SIZE . '/');

	// Create output directory if it doesn't exist (will be named according to the value of "SET_THUMB_SIZE"
	if (!file_exists (DIR_PREVIEWS) ) { mkdir (DIR_PREVIEWS, 0777); }

	$list	= glob ('*.png'); // .jpg can also be processed, simply change from .png
	$thumb	= new imagick ();

	foreach ($list as $name)
	{
		// Skip existing thumbnails, in case the script times out while dealing with hundreds of things,
		// you can just refresh the page and continue where you left off
		if (file_exists (DIR_PREVIEWS . $name) ) { continue; }

		$path	= realpath ($name);

		$thumb	-> readimage ($path);
		$thumb	-> trimimage (0); // "Tolerance" for border detection - change this to work even on lossy JPGs
		$thumb	-> setimagepage (0, 0, 0, 0);
		$thumb	-> thumbnailimage (SET_THUMB_SIZE, SET_THUMB_SIZE, true);
		$thumb	-> writeimage (DIR_PREVIEWS . $name);
		$thumb	-> clear (); $thumb -> destroy ();
	}

?>

This has saved me a lot of time and I want you to have it.

Edited by Gnac, 01 November 2012 - 02:09 PM.

Posted Image

Pick-a-BRICK: LINK | SET | SHELF

#29 Calabar

Calabar

    Posts: 2365
    Joined: 11-April 10
    Member: 10232
    Country: Italy

Posted 01 November 2012 - 11:27 AM

Thanks, very useful.
I already thought to an online solution, but it has a limit: if you have not a line that ensure you a fast upload, the process is very slow.
Or do you intend to use it in locale?

PS: what do you mean with "trimming non-transparent areas"?
Usually the portion of the image that need to be cut out is transparent (transparency obtained using Alpha Layer).
"Official LEGO Sets made in LDD" topic: Read guidelines before posting!

#30 Gnac

Gnac

    Posts: 389
    Joined: 05-August 12
    Member: 30056
    Country: England

Posted 01 November 2012 - 11:48 AM

Agh, I described "Trimming non-transparent areas" wrong. It works just as you describe - "trimimage (0)" will trim all horizontal and vertical borders which are transparent (or even a solid colour), leaving just the centre part of the image with all the detail. The zero controls the tolerance, so higher values should work even on JPGs with compression artifacts.

The script can be executed online, but yes, I run it on my laptop using a nice local webhost package called XAMPP.
Because ImageMagick is a commandline app, it can be used easily with many scripting languages, so perhaps Python or something similar might be easier than setting up a localhost just to use PHP.

EDIT: There is an even easier way, and it was right under my nose: ImageMagick includes a commandline tool called "mogrify", which is suited for batch processing. Best of all, it's cross-platform!

mogrify -trim -fuzz 0 +repage -thumbnail 256x256 *.png

This will do the same trim and resize operations on a directory of files as the PHP script above, BUT it will overwrite the original files.

Edited by Gnac, 01 November 2012 - 02:37 PM.

Posted Image

Pick-a-BRICK: LINK | SET | SHELF

#31 Calabar

Calabar

    Posts: 2365
    Joined: 11-April 10
    Member: 10232
    Country: Italy

Posted 01 November 2012 - 02:25 PM

The problem is that create a local webserver is too difficult for the great part of the users.
The "ideal" thing would be a simple file that executed inside a directory containing the images will create cropped and resized thumbnails, but I didn't find nothing similar. I'm working with irfanview but unfortunately it seems to be unable to manage alpha channel transparency correctly.

If you want to create a complete "step-by-step" guide for your script, I'll post it in the first page.
You could sent it to me using private messages.
"Official LEGO Sets made in LDD" topic: Read guidelines before posting!

#32 Calabar

Calabar

    Posts: 2365
    Joined: 11-April 10
    Member: 10232
    Country: Italy

Posted 22 January 2013 - 12:32 PM

Added a little guide that shows how to use ImageMagik to execute batch crop and resize of the images.
It is a WIP still, any contribute for MacOS and Linux will be appreciated.
"Official LEGO Sets made in LDD" topic: Read guidelines before posting!

#33 bbqqq

bbqqq

    Posts: 816
    Joined: 01-November 10
    Member: 14020

Posted 16 February 2013 - 02:17 PM

I found that with PrintScreen key can snap high quality 32xAA screenshots on Nvidia GTX660M.
But the Ctrl+K can not.

Posted Image
LDD 32xAA screenshot by Nachapon S., on Flickr

Posted Image
LDD high quailty screenshot by Nachapon S., on Flickr

Edited by bbqqq, 16 February 2013 - 02:40 PM.

Four interactive Lego 360° panorama VR Virtual Tours hosted on pan0.net :
pbat island MOC / Bob De Quatre SoNE , My new brick designs

Posted Image  Posted Image  Posted Image  Posted Image  Posted Image

YouTube Lego Pinball  YouTube Lego Bowling  My Flickr





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users