Blank canvas with the same size as a given image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Blank canvas with the same size as a given image

Post by whugemann »

As an afterthought to viewtopic.php?f=1&t=21928 I would like to know whether one can produce a blank canvas of the same size as a given image with just one IM command line. In my answer to this thread I pointed out a way to perform this task in a script. I tried to do it in just one command line, but did not succeed.
Wolfgang Hugemann
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Blank canvas with the same size as a given image

Post by fmw42 »

By blank do you mean white, black or transparent

Many ways to do it. 1) use -colorize 2) use -evaluate set , etc

see http://www.imagemagick.org/Usage/canvas/

convert image -fill somecolor -colorize 100% result
convert image -evaluate set 0% (or 100%) result
convert image -threshold -1 (or -threshold 100%) result
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Blank canvas with the same size as a given image

Post by whugemann »

Thanks Fred, it seems like this was rather obvious ...

I usually search within the Usage section of the ImageMagick website -- and would have found the examples for sure, as I have just tested.

I have just figured out an easy way to restrict the Google search to the Usage section of IM's website, without having to type "site:imagemagick.org/Usage" every time: The direct URL to Googles advanced search with this option set is
https://www.google.de/advanced_search?q ... .org/Usage
which I added to my Firefox bookmarks, grouping it with the other IM-related bookmarks by bracketing them by horizontal lines.

It would however possibly be a good idea if Anthony would offer a search field on the top page of the Usage section.
Wolfgang Hugemann
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Blank canvas with the same size as a given image

Post by fmw42 »

User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Blank canvas with the same size as a given image

Post by whugemann »

No, I haven't -- thanks. But I am still more fond of Anthony's problem oriented approach. My (and other people's, I guess) basic problem is that there a numerous ways to achieve a certain thing with ImageMagick, such that you just get lost within all these possibilities. So it is often more productive to just search Anthony's pages for some clue words.
Wolfgang Hugemann
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Blank canvas with the same size as a given image

Post by anthony »

Thanks that is nice to hear. The offical reference page was very hard to use, (still is but it is a lot better).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Blank canvas with the same size as a given image

Post by fmw42 »

The reference is useful (to me) when I know what function I want to use, but cannot find it easily in the Usage pages. Both are very helpful.

I would certainly second a request for a search engine for the Usage pages, if that is not too terribly hard to implement. But I suspect that Anthony makes changes to the pages so often it might be hard to keep up creating and index for the search engine. But perhaps he can automate that.

I know his time is limited as he is working on the IM 7 development. So this may have to wait for while.
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Blank canvas with the same size as a given image

Post by whugemann »

fmw42 wrote:I would certainly second a request for a search engine for the Usage pages, if that is not too terribly hard to implement.
The most basic approach would be that you just offer a text field that forwards the search to Google, restricticting the search to the Usage section of IM's website. This is about five lines of HTML code, see http://www.askdavetaylor.com/how_can_i_ ... _site.html.

The disadvantage of this approach is that this will cause the user to leave the current website, as the Search button will lead him/her to Google. There are ways of embedding a Google custom search engine in your website for free, see http://www.google.com/cse, but this will come along with ads or will cost a yearly fee if free of ads.

I personally have made good experience with the Zoom search engine by Wrensoft, an Australian (one man) enterprise, see http://www.unfallrekonstruktion.eu/inde ... tsuche.php. (Sorry, that's in German, try searching for glatteis [= black ice].) In this case it searchs my book and gives you the page where something is written on the issue your looking for, but the original intent of the Zoom search engine is to search your own website. As far as I remeber, the PHP version of the engine costed about 100 Euros and was rather easy to handle. There should be ways of getting hold of that money ...

Another possible approach would be a re-desing of the entire website with a CMS. Right at the moment, I am re-designing my own website with Wordpress and find it rather easy to handle. Wordpress seems to generate a search index by default and offers a search button on the main page of the site. Although re-design sounds like a lot of work, it's actually not, because you can re-use existing content via copy & paste. The numerous images could however become a problem.
Wolfgang Hugemann
Post Reply