Mogrify keeps adding " ~ " to extension.

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
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

Hello,

I have a problem that mogrify keeps adding the "~" symbol behind my files.
I am trying to resize and add white space to 7 images

the file structure is as follows:

C:\Users\webdesign\Desktop\aanpassingen\ (this folder contains 7 .jpg files that need the same cropping and added white borders.

this is the code I am using:
mogrify -resize 450x450 C:\Users\webdesign\Desktop\aanpassingen\2\*.jpg: -gravity center -background white -extent 500x500 C:\Users\webdesign\Desktop\aanpassingen\2\*.jpg
What seems to be the problem that is causing the files with ~ to appear?
Here's a screenshot:
http://pbrd.co/1DK58wD
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Mogrify keeps adding " ~ " to extension.

Post by snibgo »

I don't use mogrify, but the syntax looks wrong. What is "C:\Users\webdesign\Desktop\aanpassingen\2\*.jpg:", with the colon at the end, for?
snibgo's IM pages: im.snibgo.com
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

I have no idea really, I found an example syntax and added my own paths.

It also works like this:
mogrify -resize 450x450 -gravity center -background white -extent 500x500 C:\Users\webdesign\Desktop\aanpassingen\2\*.jpg
It does the trick, but duplicates every image and adds a ~ to the end. So it overwrites the original file (wich is good) but why does it make those extra files? Am I missing a piece of code?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify keeps adding " ~ " to extension.

Post by fmw42 »

try adding -format jpg before the C:\...

Perhaps your input files have spaces at the beginning or some other hidden character?
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

fmw42 wrote:try adding -format jpg before the C:\...

Perhaps your input files have spaces at the beginning or some other hidden character?
As you can see by the screenshot in my original post, the files are named:

441.92.0052.jpg
441.92.0053.jpg
441.92.0054.jpg
441.92.0055.jpg
441.92.0056.jpg
441.92.0057.jpg

The original files are overwrited and there are an extra set of files created after the batch:

441.92.0052.jpg~
441.92.0053.jpg~
441.92.0054.jpg~
441.92.0055.jpg~
441.92.0056.jpg~
441.92.0057.jpg~

The extra files arent showing up as a picture in windows explorer. If I delete the ~ symbol in the filenames the files change into the orgiginal images where the batch first started.

It looks like mogrify overwrites the original files and makes a backup of the files by adding the ~ symbol... very strange.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Mogrify keeps adding " ~ " to extension.

Post by snibgo »

Do you have full read/write/delete access to the directory C:\Users\webdesign\Desktop\aanpassingen\2\ ?
snibgo's IM pages: im.snibgo.com
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

Yes I am administrator and changed the folders by unticking read only.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Mogrify keeps adding " ~ " to extension.

Post by Bonzo »

Have you tried a simple resize and a separate -extent to see which may be causing the problem.

Have you tried a different jpg with a simple filename to see if the full stops could be causing a problem or if there is something wrong with your jpg images.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify keeps adding " ~ " to extension.

Post by fmw42 »

Is there a hidden or extra character such as a space at the end of your filenames?
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

No hidden or extra characters.. I tried a simple -trim command. Same result. deleting the full stops doesn't help either. I think it has to do with the *.jpg format.. If I adress 1 file specifically the commands work well. But I need to batch convert all the images..
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify keeps adding " ~ " to extension.

Post by fmw42 »

Did you add -format jpg to your command? Did that help?

Is there a space at the end of your command after *.jpg?

I have never seen this issue before. It has worked fine for me. Try writing to a new empty directory using -path newdirectory in your command.
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

Adding -format jpg doesn't help. -format ".jpg" makes copies of the original but resized and added whitespace like it should:

441.92.0052..jpg
441.92.0053..jpg
441.92.0054..jpg
441.92.0055..jpg
441.92.0056..jpg
441.92.0057..jpg

But this time it adds a " . " to the end of the name. But not after the file extension, so the duplicated files are images.
If I do -format "jpg" or -format jpg , the results are the same, ending up with copies with " ~ " added to the filename.

I can't see any spaces behind the filenames. Writing to an empty directory doesnt do anything with the files..

ps: in this thread I see that magick brought out a beta version: viewtopic.php?t=25683
I tried to find an .exe install but all I could find was version 7. So I installed that version and retried the mogrify from version 7, but still no luck :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify keeps adding " ~ " to extension.

Post by fmw42 »

But this time it adds a " . " to the end of the name
That is because you added a . in -format ".jpg". IM knows convert to whatever argument you specify by the name used. That is why you do not need the . in the -format argument
pancakegh
Posts: 8
Joined: 2015-02-12T09:31:45-07:00
Authentication code: 6789

Re: Mogrify keeps adding " ~ " to extension.

Post by pancakegh »

Yeah but in my last post I tried " -format jpg " and that still gave me the added " ~ ". I found a workaround for the problem. I was running cmd via Robotask and adding the commands as parameters for that task. Now I made a .bat file with the same code wich I execute via robotask and that works now. I think IM was somehow conflicting with Robotask wich outputted the wrong path/extension.
Post Reply