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?".
			
		
		
			
				
																			
								imanasya 							 
									
		Posts:  36  		Joined:  2018-10-05T11:21:07-07:00 		
		
											Authentication code:  1152 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by imanasya   »  2018-10-07T10:56:42-07:00 
			
			
			
			
			
			Thank you, snibgo. I did what you suggested and it looks like it works, but I'm not sure that I did everything right. Can you look at this code? I tried to do Fred's line only if (w1>h1 & w2<h2):
Code: Select all 
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1,2 delims=:" %%x in ('convert 0.jpg -fuzz 2%% -trim +repage -format %%w:%%h +write info: tmp0.png') do set a/ w1=%%x&set a/ h1=%%y
for /f "tokens=1,2 delims=:" %%x in ('convert 1.jpg -fuzz 2%% -trim +repage -format %%w:%%h +write info: tmp0.png') do set a/ w2=%%x&set a/ h2=%%y
if !h1! LSS !w1! (
  if !w2! LSS !h2! (
    magick 0.jpg 1.jpg -fuzz 2%% -trim +repage -set option:dim "%%[fx:max(max(u.w,v.w),max(u.h,v.h))]" -filter Catrom -resize "%%[dim]x%%[dim]" -unsharp 0x1+0.8+0.05 -background white -gravity center -append -quality 100 combined.jpg
  )
) else (
  magick 0.jpg -fuzz 2%% -trim +repage -quality 100 first.jpg
)
Is it possible not to create temp files like tmp0.png?
 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								snibgo 							 
									
		Posts:  12159  		Joined:  2010-01-23T23:01:33-07:00 		
		
											Authentication code:  1151 
												Location:  England, UK 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by snibgo   »  2018-10-07T11:11:18-07:00 
			
			
			
			
			
			If you don't want to save the result, use "NULL:" as the output.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								imanasya 							 
									
		Posts:  36  		Joined:  2018-10-05T11:21:07-07:00 		
		
											Authentication code:  1152 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by imanasya   »  2018-10-07T11:17:57-07:00 
			
			
			
			
			
			It works, thanks
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								imanasya 							 
									
		Posts:  36  		Joined:  2018-10-05T11:21:07-07:00 		
		
											Authentication code:  1152 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by imanasya   »  2018-10-07T11:32:09-07:00 
			
			
			
			
			
			One last question: If I would use -write info: NULL in this line
Code: Select all 
for /f "tokens=1,2 delims=:" %%x in ('convert 0.jpg -fuzz 2%% -trim +repage -format %%w:%%h +write info: NULL') do set a/ w1=%%x&set a/ h1=%%y
Does that mean that -fuzz 2%% -trim +repage would done twice:
here:
Code: Select all 
for /f "tokens=1,2 delims=:" %%x in ('convert 0.jpg -fuzz 2%% -trim +repage -format %%w:%%h +write info: NULL') do set a/ w1=%%x&set a/ h1=%%y
and here:
Code: Select all 
magick 0.jpg 1.jpg -fuzz 2%% -trim +repage -set option:dim "%%[fx:max(max(u.w,v.w),max(u.h,v.h))]" -filter Catrom -resize "%%[dim]x%%[dim]" -unsharp 0x1+0.8+0.05 -background white -gravity center -append -quality 100 combined.jpg 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								snibgo 							 
									
		Posts:  12159  		Joined:  2010-01-23T23:01:33-07:00 		
		
											Authentication code:  1151 
												Location:  England, UK 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by snibgo   »  2018-10-07T13:02:41-07:00 
			
			
			
			
			
			Yes. But if you write the first to a file, then the second can read that file so it doesn't repeat the work.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								imanasya 							 
									
		Posts:  36  		Joined:  2018-10-05T11:21:07-07:00 		
		
											Authentication code:  1152 
							
						
		 
		
						
					
													
							
						
									
						Post 
					 
								by imanasya   »  2018-10-08T01:01:39-07:00 
			
			
			
			
			
			Thank you