Pages: [1]   Go Down

Author Topic: Running a batch script during processing of a recipie on Windows  (Read 424 times)

UnfamiliarLight

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 52
    • Unfamiliar Light

This is not really a question more of a report. I had a problem to solve - how to add a border onto an image that I wanted to display on Chromecast. I just got a chomecast device and its ambient mode allows you to display a collection from google photos. Once I had my device setup I created an album for it to display. It worked OK but the aspect ratio of my images didn't quite fit and I noticed it was cropping the edges off all sides.

Last night and this morning I tackled the problem. I could not get clarity on if the chromecast was displaying 1080p or 720p (I do not have the 4k device) but it was displaying 1080 ish images OK so I chose to use that resolution. I did get clarity that the aspect ratio is 16:9 - not news I know. After cropping my images to 16:9 I noticed that they were still cropped all around. Sigh. I decided to add a border to my images to compensate. The plan was to use Imagemagick (https://imagemagick.org) to add the border after the fact. I ran a bunch of commands to test various border sizes (outputting overlay text too so I could tell on screen which images has what border) and found that the chromecast is cropping 48 pixels off each side and 28 off of the top and bottom. This batch command works to add that to an image (takes the file name as a parameter and updates that image with the border):
Quote
convert %1 -bordercolor white -border 48x28 %1

Then I remembered recipes can "Open with" a program at the end of running. But being that this is Windows C1 has no automation that I can use. However I did find a Stack Exchange question and answer that pointed to an application that can make a .exe that will run a .cmd file. Now that I have an .exe file that adds a border I can add that to my "For Chromecast" recipe and everything is done automatically.



The important take away is that with this method you can run any Imagemagick command at the end or a processing recipe. In fact you can run more that that all on Windows.

Another fun thing I found was that the chromecast automatically discarded "obviously bad" images. Sadly that algorithm is not perfect and it discarded some of my bird in flight images where the bird head is sharp and the wings are blurred against a blue sky. You can turn that off by selecting "Live Album" in the ambient options for chromecast. Man that was not obvious and was probably the biggest obstacle I had becasue I picked such an image to do my border testing with.
Logged
Pages: [1]   Go Up