Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Nov 2005
Posts: 70
|
ImageWriter problem
I'm trying to pad and or resize all pictures in a certain folder.
Trying to write the results of a suitable avisynth script I get no output of the ImageWriter at all.. Code:
Pic=ImageSource("D:\Data\Digital Camera\test\1967 05 06 Ans op haar kamer Sancta Maria.jpg")
Pic_W=Pic.Width
Pic_H=Pic.Height
GScript("""
If(FMod(Pic_H,2) > 0)
{
Pic=Pic.Crop(0, 1, 0, 0)
}
If(FMod(Pic_W,2) > 0)
{
Pic=Pic.Crop(1, 0, 0, 0)
}
""")
Pic_W=Pic.Width
Pic_H=Pic.Height
GScript("""
If(3.0*Pic_W/(4.0*Pic_H) > 1.01 ) #900x628--->900x675
{
factor=3.0*Pic_W/(4.0*Pic_H)
# Height too small adjust to desired 4:3 aspect ratio by adding borders Top, Bottom
Border=(3*Pic_W/4-Pic_H)/2
Pic=Pic.AddBorders(0, Border, 0, Border).Subtitle(String(Pic_W)+"x"+String(Pic_H)+"/"+"Height too small "+String(factor))
}
If (3.0*Pic_W/(4.0*Pic_H) < 0.99 ) #628x900--->1200x900
{
factor=3.0*Pic_W/(4.0*Pic_H)
# Width too small; AddBorders Left, Right
Border=(4*Pic_H/3-Pic_W)/2
Pic=Pic.AddBorders(Border, 0, Border, 0).Subtitle(String(Pic_W)+"x"+String(Pic_H)+"/"+"Width too small "+String(factor))
}
""")
pic=pic.ConvertToRGB24
pic.ImageWriter(file="D:\Data\Digital Camera\test", type="png", start=0, end=1 )
return pic.IsFormat
__________________
There is nothing in such perfect harmony with itself as a "contradictio in terminis" |
|
|
|
|
|
#2 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,411
|
Perhaps see here:- http://forum.doom9.org/showthread.ph...er#post1713501
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#3 | Link | |
|
Retried Guesser
Join Date: Jun 2012
Posts: 1,371
|
Quote:
Code:
pic.ImageWriter(file="D:\Data\Digital Camera\test", type="png", start=0, end=1 ) return pic.IsFormat |
|
|
|
|
|
|
#4 | Link | |
|
Registered User
Join Date: Nov 2005
Posts: 70
|
Thanks for the prompt reactions!
Quote:
Code:
return pic.ImageWriter(file="D:\Data\Digital Camera\test", type="png", start=0, end=1 ) IsFormat is an selfwritten function which adds the type and size of the movie in a subtitle(like, "YV12/720x576")
__________________
There is nothing in such perfect harmony with itself as a "contradictio in terminis" |
|
|
|
|
|
|
#5 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,411
|
Code:
pic.ImageWriter(file="D:\Data\Digital Camera\test", type="png", start=0, end=1 ) # Assigns result to implicit last return Last.IsFormat
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#6 | Link |
|
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Your script from the first post works for me, I just removed the last line ("return pic.IsFormat").
How do you run the script? Does the target path exist?
__________________
Groucho's Avisynth Stuff |
|
|
|
|
|
#7 | Link |
|
Registered User
Join Date: Nov 2005
Posts: 70
|
Stainless, RaffRiff42 and Groucho:
I should have gone to bed yesterday evening instead: there wasn't any ImageWriter problem, except that I kept looking in the wrong folder. I wrote the file as: "D:\Data\Digital Camera\Test" whereas I constantly looked(and should have written): "D:\Data\Digital Camera\Test\Test" which properly resulted in the file "Test000000.png" in the directory where I was looking all the time. I'm getting too old I'm afraid for this altogether. My apologies.
__________________
There is nothing in such perfect harmony with itself as a "contradictio in terminis" |
|
|
|
|
|
#9 | Link | |
|
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Code:
Function IsFormat(clip c)
{
text=IsYV12(c)?"YV12":ISYUY2(c)?"YUY2":IsRGB24(c)?"RGB24":IsRGB32(c)?"RGB32":"other"
return Subtitle(c, text+"\n"+String(c.Width)+"x"+String(c.Height), size=13, y=c.height-26, lsp=0)
}
__________________
Groucho's Avisynth Stuff |
|
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Nov 2005
Posts: 70
|
I must apologize for choosing the wrong name and wil correct this here right now.
THANKS for pointing out. In the mean time, I'm encoutering a real problem with ImageWriter: the output filename seems to be automatically addded by the enumeration "000000" "000001" etc. Is there a way to avoid this while writing the picture to disk?
__________________
There is nothing in such perfect harmony with itself as a "contradictio in terminis" Last edited by gwendolien; 15th July 2016 at 21:32. Reason: forgat to mention some aspect |
|
|
|
|
|
#11 | Link | |
|
Retried Guesser
Join Date: Jun 2012
Posts: 1,371
|
Quote:
Code:
imgpath="E:\<path>\" ## output like "000000.png", "000001.png" return ImageWriter(imgpath, type="png") ## output like "file-000000.png", "file-000001.png" return ImageWriter(imgpath + "file-", type="png") ## output like "file-00.png", "file-01.png" return ImageWriter(imgpath + "file-%02d.png", type="png") |
|
|
|
|
|
|
#12 | Link | |
|
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
__________________
Groucho's Avisynth Stuff |
|
|
|
|
|
|
#13 | Link |
|
Registered User
Join Date: Nov 2005
Posts: 70
|
Thanks RaffRiff42 and Groucho2004.
The documentation pointed at will require a thorough study I'm afraid. Using the examples of raffriff42 I still can't completely eliminate the zero's: there is always atleast 1 zero in my output when using %00d So, how do I completely eliminate the zero's in the output?
__________________
There is nothing in such perfect harmony with itself as a "contradictio in terminis" Last edited by gwendolien; 15th July 2016 at 23:27. |
|
|
|
|
|
#16 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,411
|
Code:
ImageWriter("Test%.0d.jpg",0,0,"jpg")
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
![]() |
| Tags |
| imagewriter, outputfile |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|