View Full Version : ImageMagick Reader / Writer for AviSynth v1.60


Wilbert
16th March 2008, 17:24
This plugin consists of two filters: ImmaRead and ImmaWrite. The former reads images and the latter writes images to your hard drive.

ImmaRead supports the following formats:

* bmp, bmp3/4, dds, dpx, gif, jng, jpg, jp2, mng, pam, pbm, pcx, pgm, png, pnm, ppm, psd, svg (partial), tga, tiff, webp and wmf;
* formats with an alpha channel: gif, jng, png and tiff;
* gif and mng animations, multipage ppm and tiff, multilayer psd;
* 8 bit grayscale images (any alpha channel that is present is dropped);
* vector images: eps, pdf and ps (you need to install GhostScript, for example 8.64 (gs864w32.exe) or more recent; might be convienient to install GhostView (gsv50w32.exe) too although that's not necessary);
* raw camera support (3FR, CR2, DCR, DNG, ERF, MEF, MRW, NEF, ORF, PEF, RAF, SR2 and X3F) (you need to copy the patched version of dcraw.exe which is included in this package in a folder, say C:\Program Files (x86)\dcraw, and add the folder as a PATH system variable in the environmental variables).

Note that raw files are not supported by ImmaRead, since they can be opened by the plugin RawSource.

ImmaWrite supports the following formats:

* bmp, bmp3/4, dds, dpx, gif, jng, jpg, jp2, mng, pam, pbm, pcx, pgm, png, pnm, ppm, psd (only one layer?), svg (partial), tga, tiff, webp and wmf;
* formats with an alpha channel: gif, jng, png and tiff;
* gif, mng and psd animations, multipage ppm and tiff;
* 8 bit grayscale (with or without an alpha channel) images;
* raw images: either RGB or YCbCr depending on the input (for YCbCr with the following order of the planes: Y,U,V);
* YUV4MPEG (y4m): 4:2:2, 4:4:4, 4:2:2, 4:2:0mpeg2, 4:1:1 and mono are supported as planar formats with the following order of the planes: Y,U,V [see y4m: http://wiki.multimedia.cx/index.php?title=YUV4MPEG2; http://linux.die.net/man/5/yuv4mpeg];
* vector images: eps/eps2/eps3, pdf and ps/ps2/ps3.

Note that ImmaWrite doesn't support svg, wmf, raw digital photos or multi-layer psd.

Grayscale images are opened as Y8. RGB images are opened as RGB32 (when there is an alpha channel present) or as RGB24 (if there is no alpha channel present). Other formats (such as CMYK) are converted to RGB.

You need the ImageMagick dll's (http://www.wilbert.dijkhof.com) in order to be able to use this plugin. They should be copied to some folder (any folder will do). You need to set the MAGICK_HOME variable to the location of ImageMagick dll's (under Settings -> System -> Advanced -> Environment Variables -> Add MAGICK_HOME as a user variable), or you need to provide it using the magick_home argument. Thus for example, magick_home = "C:\\WINNT\\system32".

Changelog in v1.60:

* updated to AVISYNTH_INTERFACE_VERSION = 6 (so the plugin requires AviSynth v2.60).
* updated ImageMagick libraries to v7.0.2-10 (ported code to MagickCore API 7.0).
* ImmaRead: grayscale images are opened as Y8, non-grayscale images as RGB24 (or RGB32 if there is an alpha channel present).
* ImmaWrite: added dithering methods "Riemersma" and "FloydSteinberg".
* ImmaWrite: added the new 2.6 colorformats for raw/y4m.
* ImmaWrite: the color option is changed to color_max.
* ImmaWrite: added quality and sampling_factor options for jpeg.
* ImmaWrite: added the compression option.

Enjoy ;-)

download:
* plugin: http://www.wilbertdijkhof.com/Immaavs_v160.zip
* ImageMagick dll's: http://www.wilbertdijkhof.com/ImageMagick-7.0.2_dll.zip (copy the dll's and xml files to your 32-bit system folder)

mikeytown2
17th March 2008, 03:40
So this is, in it's current form, just like ImageSource() (http://avisynth.org/mediawiki/ImageSource) but on steroids!
If i ever wanted to update this Plugin with a new version of imagemagick (http://www.imagemagick.org/script/binary-releases.php#windows) how easy would that be?
In the future, would it be possible to use the imagemagick library as another filter. So i could use imagemagick's image processing in my script? would i ever want to do this?

I downloaded the zip and extracted everything. I tried running this in the Release folder but it says 'LoadPlugin: unable to load "immaavs.dll" '
LoadPlugin("immaavs.dll")
Immaread("goldpetals.gif")
All 28 files from the zip are in the Release folder including the above 2 files. Timestamp of the dll is 3/16/2008 2:49PM


Thanks for your time!

ps u might want to change the title in the htm doc to something other then ColorMatrix :p

Wilbert
17th March 2008, 22:23
If i ever wanted to update this Plugin with a new version of imagemagick how easy would that be?
It took me ages to get it working on my PC. But it still has to work on yours using the dll's alone :)

You need to recompile ImageMagick (all libs and dlls), and after that you need to recompile the plugin (linking against some of the libs).

I downloaded the zip and extracted everything. I tried running this in the Release folder but it says 'LoadPlugin: unable to load "immaavs.dll" '
Crap. I guess copying all dlls to your system folder doesn't help?

Could you try the following command-line utility:

http://www.geocities.com/wilbertdijkhof/core2.zip

It converts format X into format Y.

1) copy all dlls in your system folder.
2) open a dos prompt, go to the folder you put core2.exe in and type: core2.exe goldpetals.jpg test.bmp

It should convert your jpg to test.bmp. Does that work?

mikeytown2
17th March 2008, 22:52
Here are some screen shots. They might help
http://img401.imageshack.us/img401/7927/screenshotcg5.th.png (http://img401.imageshack.us/my.php?image=screenshotcg5.png)
http://img508.imageshack.us/img508/9118/screenshot2dp3.th.png (http://img508.imageshack.us/my.php?image=screenshot2dp3.png)

Edit
Looks like the zip doesn't have CORE_RL_xlib.dll in it

McCauley
17th March 2008, 23:04
Hi Wilbert,

thanks for this plugin.
Is there a chance that ImageMagick will support the DNG format in the near future? That would be great, because one could use a RAW converter without Photoshop to convert DNG to a compatible format. That would be a tremendously useful feature for Stop Motion movies.

Regards
McCauley

Wilbert
17th March 2008, 23:49
Edit
Looks like the zip doesn't have CORE_RL_xlib.dll in it
Here's a package with some more dlls:

http://www.geocities.com/wilbertdijkhof/core2.zip

Could you try core2.exe again?

Is there a chance that ImageMagick will support the DNG format in the near future? That would be great, because one could use a RAW converter without Photoshop to convert DNG to a compatible format. That would be a tremendously useful feature for Stop Motion movies.
Perhaps. The list with supported formats http://www.imagemagick.org/script/formats.php says the following about it:

"Requires an explicit image format otherwise the image is interpreted as a TIFF image (e.g. dng:image.dng)."

I'm not sure what it means. Does it work in E-Male's own plugin?

mikeytown2
18th March 2008, 01:05
2 More screen shots
http://img255.imageshack.us/img255/8241/screenshot3pu9.th.png (http://img255.imageshack.us/my.php?image=screenshot3pu9.png)
http://img187.imageshack.us/img187/7481/screenshot4dk7.th.png (http://img187.imageshack.us/my.php?image=screenshot4dk7.png)

If we can't figure this out in a couple of days i could let u mstsc into my box. I use it on the go.
http://www.kood.org/terminal-server-patch/


BTW time stamp of core2.exe is on the 9th with this latest zip.
And there are only 2 files in the zip

squid_80
18th March 2008, 05:46
Wilbert: core_rl_magick_.dll seems to have dependencies on:

CORE_RL_BZLIB_.DLL
CORE_RL_LCMS_.DLL
CORE_RL_XLIB_.DLL
CORE_RL_ZLIB_.DLL
which all seem to be missing.

Archimedes
18th March 2008, 11:33
A possibility to do some image editing would be very nice. ;-)

For example, resizing without gamma errors.

1. Convert to 16 bit format
2. Set gamma = 1/2.2
3. Resize
4. Set gamma = 2.2
5. Convert to 8 bit format

Wilbert
18th March 2008, 20:25
@mikeytown2,

Sorry, i put up the wrong zip file. Here's the correct one:

http://www.geocities.com/wilbertdijkhof/core2_dll.zip

These are precisely the ones that squid_80 mentioned. Could you try it again?

mikeytown2
18th March 2008, 20:45
@mikeytown2,

Sorry, i put up the wrong zip file. Here's the correct one:

http://www.geocities.com/wilbertdijkhof/core2_dll.zip

These are precisely the ones that squid_80 mentioned. Could you try it again?

It works, the resulting bmp file looks good.

Wilbert
18th March 2008, 21:26
It works, the resulting bmp file looks good.
Great! What about the plugin? Can you get that to work?

mikeytown2
20th March 2008, 04:39
It works when i have these 32 files in the same dir
http://img228.imageshack.us/img228/6360/screenshoptpv2.th.jpg (http://img228.imageshack.us/my.php?image=screenshoptpv2.jpg)

Wilbert
20th March 2008, 22:11
Great! Thanks for the confirmation!

Wilbert
23rd March 2008, 18:03
Updated to v1.2 and this time all necessary dll's are included.

changelog:

* added several new formats (like tga, jng, mng, pcx and wmf);
* support for animated formats where the images have different sizes.

Wilbert
23rd March 2008, 18:05
@McCauley,
Is there a chance that ImageMagick will support the DNG format in the near future? That would be great, because one could use a RAW converter without Photoshop to convert DNG to a compatible format. That would be a tremendously useful feature for Stop Motion movies.
I get strange error messages when trying to open some dng files i found on the internet. I will ask the ImageMagick devs what the status of dng support is.

mikeytown2
23rd March 2008, 20:37
@McCauley
If you are looking for any alt to photoshop's RAW converter, try http://www.xnview.com/ it's been helpful to me multiple times; although they don't mention DNG on their website. Wikipedia says that DNG http://en.wikipedia.org/wiki/Digital_Negative_%28file_format%29 is supported in ImageMagick. http://www.imagemagick.org/discourse-server/viewtopic.php?t=8113
http://www.adobe.com/products/dng/supporters.html

mikeytown2
26th March 2008, 23:03
The ImageMagick libraries are updated to v6.3.8-11

Quick question, which version is this?
v6.3.8-1 or v6.3.9-0
http://www.imagemagick.org/script/changelog.php

Wilbert
26th March 2008, 23:15
Quick question, which version is this?
v6.3.8-1 or v6.3.9-0
http://www.imagemagick.org/script/changelog.php
It's not on the list :confused: I guess it's from the 18/19th of February. I will update them again next time!

Wilbert
2nd April 2008, 21:28
I put a new version up before i start with write support!

Changelog:

* updated ImageMagick library to v6.4.0;
* added dds;
* added support for raw digital photos [see docs for its usage].

Wilbert
18th April 2008, 23:07
New version (v1.30) out with write support!

Wilbert
20th May 2008, 16:24
If anybody is still interested. v1.31 contains animation/multipage write support. Next version will have read/write sequence support.

edit: Does anyone know whether alpha is supported in BMP3? ImageMagick automatically creates BMP4 when feeding RGB32 (and BMP3 for RGB24), but i'm not convinced that alpha is not supported in BMP3.

Archimedes
20th May 2008, 21:51
This package includes some ImageMagick dll's which are needed to use this plugin. They need to be in the same folder as the pictures you want to open (for some reason, putting them into your system folder doesn't work).
Do you also offer a static build? Copying the pictures to the ImageMagick DLL folder are not allways very comfortable.

gzarkadas
21st May 2008, 04:00
Do you also offer a static build? Copying the pictures to the ImageMagick DLL folder are not allways very comfortable.

You can put the image magic dlls in the system32 folder and just copy the avisynth script inside the images folder, so that you can use filenames without paths when calling Imma... functions (if you use paths you will get an error).

Just tested with Immaread; had immaavs.dll in another folder, image magick dlls in system32 and used various jpeg images in various folders.

@Wilbert,
The problem has to do with path handling, but I don't know exactly where; I may have time to search deeper later.

Wilbert
21st May 2008, 21:59
You can put the image magic dlls in the system32 folder and just copy the avisynth script inside the images folder, so that you can use filenames without paths
Yes, that works :) Thanks !!!

@Wilbert,
The problem has to do with path handling, but I don't know exactly where; I may have time to search deeper later.
Let me know if you have figured this out!

Do you also offer a static build? Copying the pictures to the ImageMagick DLL folder are not allways very comfortable.
I still have to figure out how to do that :) gzarkadas, how do i do that? Do i need to add all ImageMagick libs (not just CORE_RL_magick_.lib) as lib modules in the link tab of the project settings? Or do I need to add all the libs to the project (Add to Project -> Files), just as i did with the source files.

gzarkadas
21st May 2008, 23:22
...Do i need to add all ImageMagick libs (not just CORE_RL_magick_.lib) as lib modules in the link tab of the project settings?...

Yes, all 49 libs :) (that's the number of dlls I counted with IM_MOD_... dlls included; a lot of work :p) - at Configuration properties | Linker | Input | Additional Dependencies. This will create a large dll; around 6MB.

I will send a PM with some of my test-runs; they may be of use.

Wilbert
27th May 2008, 23:26
Version 1.32 is out.

Changelog:

* changed license from "GPL v2 or later" to "GPL V2" (in order to be able to use sequence support from ImageReader/ImageWriter and AppyMessage);
* ImmaWrite: added sequence writing;
* fixed the path problem (by changing the working directory internally to the place of the image(s) and passing only the filename to the ImageMagick libs; won't work for W98) (thanks gzarkadas!);
* ImmaRead: added sequence reading and info;
* added the necessary info for compiling this plugin.

Syntax:

ImmaRead (string filename, int start, int end, bool animation, bool info)
ImmaWrite (string filename, int start, int end, string type, string mode, bool animation)

Archimedes
28th May 2008, 12:14
fixed the path problem
:thanks:

LoadDLL doesn't work, so have to copy the ImageMagick dll's to the program directory of Fritz Photo ( http://forum.gleitz.info/showthread.php?t=33835). This works now.

Is there a way to tell immaavs where to find the ImageMagick dll's (as a new parameter)? It's because, i like to copy all dll's in a subfolder of the program directory.

Wilbert
28th May 2008, 12:21
LoadDLL doesn’t work
Yes i know, but i don't know why.

Is there a way to tell immaavs where to find the ImageMagick dll's (as a new parameter)? It's because, i like to copy all dll's in a subfolder of the program directory.
What don't you include that subfolder as PATH environment variable?

Archimedes
28th May 2008, 12:33
The program itself should work without any changes to the system configuration (only AviSynth have to be installed). Is there a way within AviSynth to do that (setting a path environment for dll's)? If no, i will live with the dll’s in the main directory. That was the reason (handling of the dll's), why i asked for a static build.

Wilbert
28th May 2008, 12:44
Is there a way within AviSynth to do that (setting a path environment for dll's)? If no, i will live with the dll’s in the main directory.
I will ask Stickboy to add this to his GetSystemEnv plugin :)

stickboy
30th May 2008, 09:28
Okay, but it might take me a couple of days since I don't have a build environment set up anymore.

tacman1123
1st June 2008, 14:18
This was originally a question about installing immaavs, I've deleted the question but will provide the answer to anyone who comes across this thead.

immaavs is dependent on the ImageMagick dlls, which must be installed in the system directory. Those dlls can be found at

http://www.geocities.com/wilbertdijkhof/ImageMagick_dll.zip

Wilbert -- maybe add a README file to the zip that includes this?

Thanks for providing this great tool!

Tac

Wilbert
1st June 2008, 14:27
You need to put the following dll's:
http://www.geocities.com/wilbertdijkhof/ImageMagick_dll.zip
in your system folder, and immaavs.dll in your plugin folder. Does that work?

stickboy
9th June 2008, 11:25
I've updated my GetSystemEnv plug-in (http://www.avisynth.org/stickboy/) to include a SetWorkingDir function. Sorry for the delay. Let me know if there are any problems.

Archimedes
9th June 2008, 14:23
I can’t benefit from SetWorkingDir so far. My working directory has to be the program directory. All plugins, libaries and DLL’s are in sub folders under the program directory. A typical script looks like this (simple example with Rotate):

LoadPlugin("plugins\Rotate\Rotate.dll")

Import("lib\FritzPhoto\FritzPhoto.avs")

#------------
angle = 1.0
width = 0
height = 0
color = 0
#------------

isYV12() ? YV12toRGB() : last
Rotate(angle, width, height, color)
As you can see, i’m working with relative path names.

Wilbert
9th June 2008, 16:40
I guess i need to make a static build then.

Maxiuca
21st June 2008, 23:20
I've tried plugin today to load a sequence of TIFFs but unfortunatelly the image sequence reading does not work properly.

For example if you use file matrix like "name.%04d.tif" and "start=1000, end=3000" parameters, the plugin will just read first 2000 tiffs starting from "name.0000.tif" and ending with "name.1999.tif" instead of reading from "name.1000.tif" to "name.3000.tiff"

Wilbert
21st June 2008, 23:31
For example if you use file matrix like file.%04d.tif and "start=1000, end=3000" parameters, the plugin will just read first 2000 tiffs starting from file.0000.tif and ending with file.1999.tif
I'll report the bug to the author of this plugin in the other thread.
Thanks for the bugreport! I will fix it for the next release.

Mug Funky
22nd June 2008, 06:00
that's weird - i could have sworn i read an image sequence that way a few days ago. i may have been using vanilla imagesource though.

btw - write support is the bomb. i can make dpx's directly now, and with a little finessing can maintain timecodes in the filenames (though the headers are all stamped 00:00:00:00 and the files are flagged as log, i can work around this). thanks heaps Wilbert! being able to work from a mov in pc range saved my arse (and the highlights/shadows).

mikeytown2
22nd June 2008, 07:21
In this next release, do you think you could add wild card support?
http://forum.doom9.org/showthread.php?t=109997

Comatose
24th June 2008, 19:02
When type="gif" and animated=true, it doesn't seem to be doing anything.

Wilbert
25th June 2008, 11:25
When type="gif" and animated=true, it doesn't seem to be doing anything.
Upon reading or writing? When writing an animated gif you should play the script, the animation is written when the last (selected) frame is played.

In this next release, do you think you could add wild card support?
It's on the todo list, but it won't be in the next release. I'm not sure yet if it would be convenient to include also subfolder scanning (or only scanning of the current folder). But scanning of the current folder i want to include anyway.

Comatose
25th June 2008, 11:36
Writing. I played it with and without start= and end= in MPC set to play once, just to be sure, but nothing.
I ended up just saving individual GIFs and "muxing" them them into an animated GIF with unfreez.

Um, could you add an option for disabling dithering? In anime, there usually is banding (post denoise) and most of the time it's small enough to not be noticeable but the dithering makes ugly, off colored dancing grain.

Wilbert
25th June 2008, 11:59
Ok. I will look at it on saturday.

IanB
25th June 2008, 14:25
@Comatose,

Dithering is inevitable if you save a full colour image in any restricted color format like GIF. Either save to a full color format like JPEG, or filter your clip so each frame only has fewer or equal unique colours than the format supports, e.g. N <= 256 for GIF. And I am not aware of any AVS filters specifically for reducing the unique colour count but tricks with Levels, Tweak, ColorYUV or RGBAdjust may be possible. Other filters that may also be able to be adapted.

Leak
25th June 2008, 19:21
Actually, GIF can contain more than 256 colors (http://en.wikipedia.org/wiki/GIF#True_color), just not in the same frame. But using several frames with 0 delay in-between means you can have more than 256 colors at the same time... :)

Not that I'd advocate actually using this, mind you.

np: Sage Francis - Keep Moving (Human The Death Dance)

smok3
25th June 2008, 21:21
could all this lead to openEXR support, and HDR support generaly speaking?

Comatose
25th June 2008, 22:09
@Comatose,

Dithering is inevitable if you save a full colour image in any restricted color format like GIF. Either save to a full color format like JPEG, or filter your clip so each frame only has fewer or equal unique colours than the format supports, e.g. N <= 256 for GIF. And I am not aware of any AVS filters specifically for reducing the unique colour count but tricks with Levels, Tweak, ColorYUV or RGBAdjust may be possible. Other filters that may also be able to be adapted.
Can't dithering be disabled? I'm pretty sure I used something to save a GIF a long time ago and I could disable dithering.

It's something the compressor does voluntarily, no? That grain doesn't appear out of nowhere >:3

IanB
26th June 2008, 00:28
@Comatose,

You have to do something to reduce the number of distinct colours to the level the format supports. The IM library used here dithers. What would you like it to do? And as I said if you preprocess your image to reduce the number of distinct colours present it will not dither.

Wilbert
26th June 2008, 10:30
Can't dithering be disabled? I'm pretty sure I used something to save a GIF a long time ago and I could disable dithering.

There is a dither option which can be turned of. But like Ian said, something is done to reduce the colors.

You can also see IM will by default use a 'dither' to shade the colors over the image. This prevents the sudden changes in color over smoothly changing gradients. If you turn of dithering (using the "+dither" setting) you can clearly see what colors were merged together to generate what IM regarded as the best set of colors for this specific image. You can also see the sudden color changes that gradients of color will produce is dithering was not done.
http://www.imagemagick.org/Usage/quantize/

I will make it available as an option.

Wilbert
28th June 2008, 23:04
@Mug,
btw - write support is the bomb. i can make dpx's directly now, and with a little finessing can maintain timecodes in the filenames (though the headers are all stamped 00:00:00:00 and the files are flagged as log, i can work around this).
Someone made a perl-script for this: http://www.imagemagick.org/Usage/scripts/dpx_timecode.pl (A simple script can be used with ImageMagick to automatically increment the time code for each frame in a sequence.) See: http://www.imagemagick.org/Usage/formats/

Comatose
2nd July 2008, 20:38
@Comatose,

You have to do something to reduce the number of distinct colours to the level the format supports. The IM library used here dithers. What would you like it to do? And as I said if you preprocess your image to reduce the number of distinct colours present it will not dither.
Well, isn't it reduced either way?
Like, the dithering is only in place to hide the banding that comes from the lower color resolution or something.

edit: Yup. :3

Wilbert
19th July 2008, 21:17
A while ago i released v1.33. See first post.

@Comatose, you can disable dither right now and specify the number of colors. Writing gif animations should work again.

@Maxiuca, your issue should be fixed.

Wilbert
9th August 2008, 18:30
New version: v1.34. See first post.

Adub
18th August 2008, 23:08
Hey, Wilbert. I am having some troubles getting ImmaWrite to work correctly.

I am receiving a "Immawrite does not have an argument named 'filename' " error when I drop this script into MPC:

BlankClip(length=401, width=400,height=300, color=$616264)
ShowFrameNumber(text_color=$fffffff, size=70, x=115, y=175, halo_color=$616264)
ImmaWrite(filename="C:\Documents and Settings\-----\Desktop\Logo2\",type="jpeg")

Also, if I just insert the quoted section as the first parameter, the files don't appear anywhere (that I can find).

Edit: This is with the latest version available on your site, and Avisynth 2.57 non-MT. Windows XP.

Edit2: Hmm...I am wondering if maybe it's not finding my ImageMagick libraries. All I did was deposit them into the System32 folder. But, wouldn't I be receiving an error along those lines?

Wilbert
19th August 2008, 17:29
Edit2: Hmm...I am wondering if maybe it's not finding my ImageMagick libraries. All I did was deposit them into the System32 folder. But, wouldn't I be receiving an error along those lines?
Hmm, you should get an error in that case. From this version on you need to put them in your system32 folder and set the magick_home variable (see below). I assume ImmaRead doesn't work either for you?

Did you do the following:
You need the following ImageMagick dll's in order to be able to use this plugin. They should be copied to the system folder (any other folder won't work). You need to set the MAGICK_HOME variable to the location of ImageMagick dll's (under Settings -> System -> Advanced -> Environment Variables -> Add MAGICK_HOME as a user variable), or you need to provide it using the magick_home argument. Thus magick_home = "C:\\WINNT\\system32".

Wilbert
19th August 2008, 17:37
Forget my last post. Try

BlankClip(length=401, width=400,height=300, color=$616264)
ShowFrameNumber(text_color=$fffffff, size=70, x=115, y=175, halo_color=$616264)
ImmaWrite(file="F:\",type="jpeg")

Thanks for pointing out an error in the docs (it's "file" and not "filename")! I will change that in the code.

It has another bug though. It puts the images in the wrong folder (in the same folder as the script). I will look at it.

Adub
19th August 2008, 17:46
Okay, thanks. Yes, using the "file" parameter instead, and pointing it to the same folder as the script works. But I am glad that you have also encountered the bug.

Wilbert
24th August 2008, 13:50
@Merlin7777,

Both issues should be fixed! Please test and report back.

Stakiman
25th August 2008, 16:37
I get error "Couldn't write image to "D:\000001.png"" and I am using Vista. Can this be the reason? I've set everything up and double-ensured that everything is in place. I've also included the magick_home libraries in the script.

And thanks for this plugin, though! Now I can do something I wanted to do a few months ago. :)

Adub
25th August 2008, 17:19
Okay, everything works fine. Just so you know, its a little confusing, as there are two immaavs.dll's in that zip file. The first (the "bad") one is in the initial folder. But after I noticed the folder labeled "Release" then I found the "good" one. Just something you may want to consider fixing.

Wilbert
25th August 2008, 17:32
I get error "Couldn't write image to "D:\000001.png"" and I am using Vista. Can this be the reason?
Don't know, i don't have Vista :) (1) Could you post your script? (2) Does it depend on your script? (3) Can you write it to a different format?

Okay, everything works fine. Just so you know, its a little confusing, as there are two immaavs.dll's in that zip file. The first (the "bad") one is in the initial folder. But after I noticed the folder labeled "Release" then I found the "good" one. Just something you may want to consider fixing.
Thanks! I removed the bad one from the package.

Stakiman
25th August 2008, 18:15
I tried bmp and png - still the same result.

DirectShowSource("graph.grf",audio=false,fps=23.976024)
assumefps(23.976024)
crop(0,140,0,-140)
spline36resize(1280,532)
converttoRGB24()
trim(54000,55000)
ImmaWrite("D:\",type="png",magick_home="C:\WINDOWS\system32")

Here's my script.

Wilbert
25th August 2008, 20:02
That's weird. So a script like this:

BlankClip(length=401, width=400, height=300, color=$616264).ConvertToRGB24()
ShowFrameNumber(text_color=$fffffff, size=70, x=115, y=175, halo_color=$616264)
ImmaWrite("F:\", type="png", info=true, start=2, end=5, magick_home="C:\WINDOWS\system32")

doesn't work either?

Does ImmaRead work?

Stakiman
25th August 2008, 21:45
No images are saved, although here is what goes up: http://www.imagebam.com/image/fd117c11932204
The directory D:\lol\ exists. I will check ImmaRead after a bit.

Archimedes
26th August 2008, 10:26
What about relative path names? Does magick_home='dll\ImageMagick' work?

Stakiman
26th August 2008, 15:53
If i don't put it there, another error goes up. My only reasonable solution is to downgrade to XP. Thanks to everyone! :)

Wilbert
26th August 2008, 18:08
What about relative path names? Does magick_home='dll\ImageMagick' work?
Is that a question to me? The magick_home variable needs to point to your system32 folder (or a subfolder of it) where your ImageMagick dll's are located. I haven't tried it, but i don't think that relative path names work.

Stakiman, i've forwarded your question to gzarkadas. I hope that he can help, because i've no idea what the problem is.

Archimedes
27th August 2008, 09:42
Is that a question to me? The magick_home variable needs to point to your system32 folder (or a subfolder of it) where your ImageMagick dll's are located. I haven't tried it, but i don't think that relative path names work.
Sorry. Yes, that was a question to you.

It’s because, the new version don’t work with my program. In my AviSynth scripts i’m working with relative path names (relative to the program directory). The Image Magick dll’s are in the program directory. Version 1.32 works fine so far. The new version needs the magick_home variable. How can I tell ImmaRead or ImmaWrite that the Image Magick dll’s are in the current directory (or in a subfolder)? What, if magick_home is not set? Is it possible to look in the current directory for the Image Magick dll's in that case?

Wilbert
27th August 2008, 17:34
Btw, there's a similar bug in ImmaRead (it reads images from the same location at the script).

It’s because, the new version don’t work with my program. In my AviSynth scripts i’m working with relative path names (relative to the program directory). The Image Magick dll’s are in the program directory. Version 1.32 works fine so far. The new version needs the magick_home variable. How can I tell ImmaRead or ImmaWrite that the Image Magick dll’s are in the current directory (or in a subfolder)? What, if magick_home is not set? Is it possible to look in the current directory for the Image Magick dll's in that case?
That's not possible anymore (the code got much cleaner that way). Do you really need that? Can't you copy the dll's to the system32 folder?

Wilbert
9th December 2008, 22:20
I put a new version up. See first post of this thread.

@Stakiman,
Did you get it to work by now?

Stakiman
9th December 2008, 22:35
Yes, I got it to work. :) Great plugin, thanks for the update!

qyot27
16th December 2008, 17:06
I'm attempting to load an image sequence where only the heights of the images differ. I'm using the size_x and size_y parameters, but no matter what I do, it won't correctly load any images in the sequence unless they have the same height as the first image. The other images are just displayed as:
ImmaRead: image [filename]
The initial image is 49px high, and I want all the images letterboxed to 90px. This is the script I'm using:
ImmaRead("*.bmp",start=35,end=735,gapless=true,size_x=848,size_y=90)
When I tried to create a dummy 90px high bitmap and load that as the first image, it complained that the other images didn't match the first image's dimensions.

I'm using v1.40

Wilbert
16th December 2008, 19:08
I'm attempting to load an image sequence where only the heights of the images differ. I'm using the size_x and size_y parameters, but no matter what I do, it won't correctly load any images in the sequence unless they have the same height as the first image. The other images are just displayed as:
Hmm, are you sure you are using the correct version?

Could you upload 4-5 bmp's which won't load somewhere (cause i can't replicate the issue)?

ImmaRead("*.bmp",start=35,end=735,gapless=true,size_x=848,size_y=90)
Above should load all bmp's in the current folder. It's the same as
ImmaRead("*.bmp",size_x=848,size_y=90)

Try something like:
ImmaRead("pic%3d.bmp",start=35,end=735,gapless=true,size_x=848,size_y=90)
if they are named pic35, pic36, pic735, or
ImmaRead("pic%03d.bmp",start=35,end=735,gapless=true,size_x=848,size_y=90)
if they are named pic035, pic036, pic735.

Fizick
16th December 2008, 21:36
Hi,
have we some source filter for reading jpeg, which directly import to YV12 without intermediate RGB conversion?
Most jpegs have YV12 or YV24 internal format (IMO).

qyot27
17th December 2008, 07:24
Hmm, are you sure you are using the correct version?
I only found out about this plugin a couple of hours before I posted, and downloaded it directly from the webpage linked in the first post.

Could you upload 4-5 bmp's which won't load somewhere (cause i can't replicate the issue)?
It's not that they won't load, it's that they won't load if there's a height mismatch somewhere in the sequence. I can make them load if I change the starting bmp's height, but then other images in the sequence won't load.

In other words, depending on the height the starting image is, a different set of images after it won't load. It's not predictable except by the dimensions of that first image.

In any case, I've attached a sample containing 8 bitmaps of varying heights and the script.

Wilbert
17th December 2008, 19:55
Thanks, i will fix it.

@Fizick,

I will ask around on ImageMagick's forums. I guess it should be possible, but i have no idea how.

Wilbert
17th December 2008, 21:10
@qyot27,

I think i fixed it. Could you try it again?

http://www.geocities.com/wilbertdijkhof/immaavs.dll

qyot27
18th December 2008, 14:52
@qyot27,

I think i fixed it. Could you try it again?

http://www.geocities.com/wilbertdijkhof/immaavs.dll
After copying it to C:\Program Files\AviSynth 2.5\plugins, I get a 'there is no function named ImmaRead' error. Specifying it explicitly with LoadPlugin makes the error unreadable characters, but running VirtualDub in Japanese locale reveals the error is still the same.

Do I have to redo my system settings like I did when I initially installed, or is it something else?

Wilbert
18th December 2008, 19:34
Weird :confused: I zipped it:

edit: see first post.

Now it should work fine.

qyot27
19th December 2008, 14:51
Yep, it works perfectly now. Thanks.

langman10
1st January 2009, 01:04
I can't seem to get ImmaWrite to write out to files.

Avisynth 2.5.8
immaavs.dll dated December 17th 08
ImageMagick dlls dl'ed from Wilbert's website

I can write to the same directory using ImageWriter, but not ImmaWrite, so it's not a permissions issue. I've tried dpx (my desired format) but also bmp, tif, etc.)

The script loads in VDubMod 1.5.10.2, but when I play it I get "Couldn't write image to s:\0000<framenumber>.bmp" as it plays.

The source is 1920x1080, if that makes a difference.

Here's my script:
-----------
avisource("Y:\source.avi")
converttorgb24()
trim(0,10)
ImmaWrite(last, "s:\", start=1, end=10, type="bmp", magick_home = "C:\WINDOWS\system32")
-----------

Any help is appreciated. Happy New Year!

Langman

Wilbert
1st January 2009, 14:44
Thanks for the annoying bug report :)

The magick_home argument doesn't work as you found out, but i can't figure out why not. Debugging it, i see that MAGICK_HOME is set correctly, but for some reason the ImageMagick's dll are not loaded. I will ask around.

For now you need to set it under Settings -> System -> Advanced -> Environment Variables. Add MAGICK_HOME = "C:\\WINDOWS\\system32" as a user variable.

langman10
2nd January 2009, 19:20
Thanks. Adding the user variable and logging back in did the trick.

Very handy function because I'm trying to get files that an eQ can natively import, like dpx. Great job!

Langman

morsa
24th February 2009, 17:50
I never was able to use this filter no matter what I do.

Sounds really great, but this never happened to me before...
pity..

Wilbert
24th February 2009, 21:45
What happens when you try the plugin? Do you get any error messages?

tin3tin
13th March 2009, 05:42
I guess that this must be a bug: For some wierd reason immaread seems to cut the first 12 characters from the image filepath and then can't find the file?

Wilbert
13th March 2009, 18:39
I guess that this must be a bug: For some wierd reason immaread seems to cut the first 12 characters from the image filepath and then can't find the file?
That sounds bad :)

Can you give me a script, because i can't replicate it?

tin3tin
13th March 2009, 22:13
My bad - I didn't save the script. And now I can't redo it.
I did something like this:
LoadPlugin("immaavs.dll")
Immaread("ProjectSettings.jpg", magick_home = "")
And it gave an error about not finding "ngs.jpg". Then I tried to make a copy of the image and renamed it to "ngs.jpg" and it worked... But, hey now it works fine... I must have been very sleepy. Sorry. :)

tin3tin
1st June 2009, 21:32
Have you considered adding the very powerful image manipulation options from Image Magick to your compile?

E-male did that once: http://forum.doom9.org/showthread.php?s=&threadid=90131

I haven't see him around here for years and his version is compiled with a very old version of IM.

Looking through his code, it seems to be this part(does it make any sense for you?):
class immamog : public GenericVideoFilter {
char argva[20],argvb[20],argvc[20],argvd[20];
public:
immamog(PClip _child, const char _argva[20], const char _argvb[20], const char _argvc[20], const char _argvd[20], IScriptEnvironment* env) :
GenericVideoFilter(_child){
strcpy(argva, _argva);
strcpy(argvb, _argvb);
strcpy(argvc, _argvc);
strcpy(argvd, _argvd);
}
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};

PVideoFrame __stdcall immamog::GetFrame(int n, IScriptEnvironment* env) {

PVideoFrame src = child->GetFrame(n, env);
const unsigned char* srcp = src->GetReadPtr();
const int src_pitch = src->GetPitch();
const int row_size_s = src->GetRowSize();
const int height_s = src->GetHeight();

ExceptionInfo exception;
//ExceptionInfo *exceptionb;
Image *image;
ImageInfo *image_info;
InitializeMagick(NULL);
GetExceptionInfo(&exception);
image_info=CloneImageInfo((ImageInfo *) NULL);
image=AllocateImage(image_info);
image->columns=row_size_s/4;
image->rows=height_s;

for (int y = 0; y < height_s; y++) {
ImportImagePixels ( image, 0, height_s-1-y, image->columns, 1, "BGRA", CharPixel, srcp);
srcp += src_pitch;
}

const int argc = 4;

char *argv[]={argva, argvb, argvc, argvd};

//MogrifyImage(image_info, argc, argv, &image, exceptionb ); argv - how to initialize??? <-- old comment! i had this fixed, but don't remember how

PVideoFrame dst = env->NewVideoFrame(vi);
unsigned char* dstp = dst->GetWritePtr();
const int dst_pitch = dst->GetPitch();
const int row_size_d = dst->GetRowSize();
const int height_d = dst->GetHeight();

for (int y = 0; y < height_d; y++) {
ExportImagePixels ( image, 0, height_d-1-y, image->columns, 1, "BGRA", CharPixel, dstp, &exception );
dstp += dst_pitch;
}
image=DestroyImageList(image);
image_info=DestroyImageInfo(image_info);
DestroyExceptionInfo(&exception);
DestroyMagick();

return dst;
}

AVSValue __cdecl Create_immamog(AVSValue args, void* user_data, IScriptEnvironment* env) {
return new immamog(args[0].AsClip(),args[1].AsString(""),args[2].AsString(""),args[3].AsString(""),args[4].AsString(""), env);
}

Wilbert
3rd June 2009, 21:17
Have you considered adding the very powerful image manipulation options from Image Magick to your compile?
It's on my todo list. But i can't tell you when i've time to look at it.

elmarikon
9th June 2009, 13:32
Hi guys!

I have strange Problems with the image writerOn one of my machines, I managed to make it work as it should. I did exactly the same on my second machine, and all I get is "Can't write Image to X:\..."
Has anyone got a clue what the problem could be?!

Second question is about formats. I am trying to write jpeg2000 codstreams (ImageMagick calls them .jpc). Jepeg2000 works, but I can't figure out, how to write the codestreams... is that possible anyway?

all the best so far!

SwK

elmarikon
29th June 2009, 15:33
Not even a 'no, that's not supported, you can stop searching'..?!

that's sad:-(

Wilbert
29th June 2009, 18:38
I was busy with exams :) I will look at it before this weekend.

Did you solve the first problem in the mean time?
I have strange Problems with the image writerOn one of my machines, I managed to make it work as it should. I did exactly the same on my second machine, and all I get is "Can't write Image to X:\..."
Has anyone got a clue what the problem could be?!
Perhaps it's some kind of permission problem? Are you able to read images on your second machine? Are you able to use ImageWriter on your second machine?

elmarikon
2nd July 2009, 16:22
I gave up on that one for the moment...
I can write images with imageWriter. I will have to try if i can read with immaavs
That machine has some strange Problems with DirectShowSource as well, i found out.
I guess it is fighting with MainConcept Encoder..:-(
I don't know, but i guess these two problems have kindof the same reason...

Wilbert
2nd July 2009, 21:51
@elmarikon,

Try http://www.geocities.com/wilbertdijkhof/immaavs_v135b.zip. It should be able to read and write jpc files.

I don't know how to help you with your other problem.

elmarikon
15th July 2009, 20:00
I will give it a try 2morrow!

thanxthanxthanx!:thanks:

elmarikon
20th July 2009, 11:11
Hi again!
The good news are:
-it seems to write .jpc files, now...
-Even works on my weird machine now, without any problems

so, great!
But, could it be, that the plugin ignores the "mode=TrueColor" option?
My packager returns "unexpected number of components = 1".
That normaly happens with ImageMagick, when the output is not set to "TrueColor"...

Thanx for all your effort!

SwK

Wilbert
20th July 2009, 18:48
Hi again!
The good news are:
-it seems to write .jpc files, now...
-Even works on my weird machine now, without any problems
Good! What did you change on your second machine?

But, could it be, that the plugin ignores the "mode=TrueColor" option?
My packager returns "unexpected number of components = 1".
That normaly happens with ImageMagick, when the output is not set to "TrueColor"...
I guess it has something to do with this:
ImageMagick uses 1 component for grayscale images and 3 for RGB (and 4 for RGBA). To fix, add -type truecolor before your JPC image filename.
But i'm not sure were it goes wrong. Could you post a script?

elmarikon
27th July 2009, 18:36
Good! What did you change on your second machine?

So... actualy I did not change a thing on that machine, just replaced the .dll, and suddenly it worked...

ImageMagick uses 1 component for grayscale images and 3 for RGB (and 4 for RGBA). To fix, add -type truecolor before your JPC image filename.

I guess you are right, the "-type truecolor" is the problem... It seems not to be recognized...?!


My script looks just this:
LoadPlugin("decomb.dll")
LoadPlugin("qtsource.dll")
LoadPlugin("immaavs.dll")
qtinput("Y:\blu\ReichMir_HD_letzteN.mov", color = 2, quality = 100, audio = true, mode = 1, raw = "uyvy", info = 0, dither = 0).Fielddeinterlace.ConvertToRGB.LanczosResize(2048,1152).Crop(0,36,-0,-36).ImmaWrite(filename="X:\Immaavs\",type="jpc",magick_home="C:\Windows\System32")

Wilbert
13th September 2009, 13:17
@elmarikon,

Sorry for the late reply. I'm updating the ImageMagick libs and looking at your problem again. I can't replicate your issue. Could you upload your mov somewhere?

18fps
28th September 2009, 11:02
Hi! Thank you for your great plugin. I wanted to ask something about memory usage: I have 2000 tif images at 2K resolution (more or less 2048*2048 pixels). The load well, but when I begin to process the script through VirtualDub or AvsP, I can see that it is loading each image on memory, without ever releasing, them. After 80 images it already has occupied 2700 Mb of ram, and begins to write the images on disk, without deleting them. There is some parameter that I should use to prevent this high RAM usage? If I use this plugin along with rotate() it crashes as soon as it finishes the ram.

elmarikon
4th October 2009, 21:09
@Wilbert (http://forum.doom9.org/member.php?u=2705)

Sorry for MY late reply, now!
I kinda gave up on this way of creating the images...
I have to create them for digital cinema, and there are 2 Problems:
1. As you say, your plugin currently supports no compression (which is necessary for D-cinema)
2. ImageMagick uses the JasPer (http://www.ece.uvic.ca/~mdadams/jasper/) libary for J2K. This libary cannot produce compatible files according to the DCI-Specs (http://www.dcimovies.com/DCIDigitalCinemaSystemSpecv1_2.pdf)

Only the OpenJpeg (http://www.openjpeg.org/) Libary produces suiting images for this case:-(

So I am trying to export raw images, 24bit, planar RGB and convert them with OpenJpeg (http://www.openjpeg.org/).
I could not find out how and if your plugin can do planar RGB (RRR...GGG...BBB...)...

Sorry for getting on your nerves with new issues, now but I am just trying to find the best way to do this job:-)

Thanx and all the best!

Wilbert
4th October 2009, 21:35
Sorry for MY late reply, now!
I kinda gave up on this way of creating the images...
I have to create them for digital cinema, and there are 2 Problems:
1. As you say, your plugin currently supports no compression (which is necessary for D-cinema)
2. ImageMagick uses the JasPer libary for J2K. This libary cannot produce compatible files according to the DCI-Specs

Only the OpenJpeg Libary produces suiting images for this case:-(
Too bad. Perhaps you can bug the folks of ImageMagick about it. Usually they respond fast.

So I am trying to export raw images, 24bit, planar RGB and convert them with OpenJpeg.
I could not find out how and if your plugin can do planar RGB (RRR...GGG...BBB...)...
Well, 24bit, planar BGR(A) is supported (raw=true, planar=true). However the order of the planes is different as you want (BGR instead of RGB). Is that a problem for OpenJpeg or do i need to add something to the plugin?

1. As you say, your plugin currently supports no compression (which is necessary for D-cinema)
I've added this in the coming release.

elmarikon
5th October 2009, 11:06
Too bad. Perhaps you can bug the folks of ImageMagick about it. Usually they respond fast.

I already spoke to s.o. from ImageMagick (http://www.imagemagick.org/) / GraphicsMagick (http://www.graphicsmagick.org/) about that.
They are considering a change to OpenJpeg, he said:
A coder module interfacing with the OpenJPEG (http://www.openjpeg.org/) library could be implemented which supports more modern JP2. This is why I have been on the OpenJPEG (http://www.openjpeg.org/) mailing list for a number of years. Unfortunately, I am not very impressed with the methodology used by the OpenJPEG (http://www.openjpeg.org/) project. The project seems more interested in the technology than they are with delivering a properly finished product. This makes it difficult to depend on.
So... we will see...


Well, 24bit, planar BGR(A) is supported (raw=true, planar=true). However the order of the planes is different as you want (BGR instead of RGB). Is that a problem for OpenJpeg or do i need to add something to the plugin?

Sadly OpenJpeg (http://www.openjpeg.org/) only supports RGB, no BGR:-(
I have been tying a lot of alternatives and the only (free) prog I found to export the images, OpenJpeg accepts was "IrfanView (http://www.irfanview.de/)"...
So... what do you think, will it be much work to add RGB?

Again: :thanks: a lot for all your work!!

elmarikon
5th October 2009, 16:28
oh.... and one more question:

I just noticed, that the BGR-images created by immaavs are much bigger (talking about the filesize) then RGB-images created by IrfanView (http://www.irfanview.de) or OpenJpeg (http://www.openjpeg.org/)'s decompressor.
The RGBs have 6.3MB while
the immaavs-files are around 8.4MB...

This can't have anything to do with the Order, can it?
I thought, they should have the same size, when they both have 3 components, each 8bit depth (unsigned)?! :confused::confused::confused:
I can send you the files, if you need, but sadly I can't upload them here, 'cause they are way too big...

As you know, size does matter:cool:

all the best!

thewebchat
5th October 2009, 16:35
There seems to be a 33% difference in the filesize, so perhaps one of the files has a stored alpha channel and the other does not.

elmarikon
5th October 2009, 17:48
looks like it, but they should not, because this would be defined as RGB32, then, if I'm right...

Archimedes
5th October 2009, 23:31
Wilbert, with an environment variable (MAGICK_HOME = <Program Directory>) now i'm able to use your plugin with the dlls not in the system folder. But the dlls must be in the same directory where the AviSynth script is (no problem).

But i have another big problem. Immaavs seems not to free up memory when finished. For example, when i resize a lot of images, Fritz Photo (http://forum.gleitz.info/showthread.php?t=33835) (still using the old version 1.32 of Immaavs) create for each image a new temporary AviSynth file. With each new image the memory decreases. There is no problem with ImageSource (the amount of memory remains constant when filtering a lot of images).

Wilbert
6th October 2009, 18:54
@elmarikon,
So... what do you think, will it be much work to add RGB?
That shouldn't be necessary. The following should do the trick

ConvertToRGB24() # remove alpha channel
Invert("BR") # switch red and blue channel
ImmaWrite(..., planar=true, type="raw")


@Archimedes,
But i have another big problem. Immaavs seems not to free up memory when finished. For example, when i resize a lot of images, Fritz Photo (still using the old version 1.32 of Immaavs) create for each image a new temporary AviSynth file. With each new image the memory decreases.
18fps reported the same problem. I will check it. Does it also happen with older versions?

Archimedes
6th October 2009, 19:09
18fps reported the same problem. I will check it. Does it also happen with older versions?
Yes, also with the older version. And only with ImmaRead. ImmaWrite seems to be ok.

IanB
7th October 2009, 07:09
ConvertToRGB24() # remove alpha channel
Invert("BR") # switch red and blue channel
ImmaWrite(..., planar=true, type="raw")
Oops! I think this is what you want...
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24") # switch red and blue channel, remove alpha channel
ImmaWrite(..., planar=true, type="raw")

elmarikon
7th October 2009, 19:18
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24") # switch red and blue channel, remove alpha channel
ImmaWrite(..., planar=true, type="raw")

great! That was, whet I was looking for.

Let's see, if I'm getting faster, now:-)


:thanks:

BigDid
7th October 2009, 22:00
great! That was, whet I was looking for.
Let's see, if I'm getting faster, now:-)

Hi,

It seems not by reading your post here:
http://forum.doom9.org/showthread.php?p=1332424#post1332424

I believe the discussion is more adequate here but if a mod prefers to move it elsewhere, feel free to do it.

Base is above script:
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24") # switch red and blue channel, remove alpha channel
ImmaWrite(..., planar=true, type="raw")
To MT it you can try:
1/
Setmtmode (2,x) # x=0 or number of cores (8?)
to be inserted between MergeRGB and ImmaWrite or line before Merge RGB; whatever working or quicker.
2/
or MT(...)
either
MT("""ImmaWrite(..., planar=true, type="raw")""")
or
MT("""
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24")
ImmaWrite(..., planar=true, type="raw")
""") # if working;
if not working when processing images, a workaround is to declare an overlap at the end like
""",x,y)
x being the number of threads or cores (8?)
y being the overlap: 4 or 8

For general info see: http://avisynth.org/mediawiki/MT_support_page

Maybe you already tried it but without report and your script, it will be difficult to help :eek:

Did

Gavino
8th October 2009, 00:05
MT("""ImmaWrite(..., planar=true, type="raw")""")
or
MT("""
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24")
ImmaWrite(..., planar=true, type="raw")
""")
ImmaWrite won't work with the MT function (though it might with SetMTMode).
MT divides each frame into sections, with each part being processed by a separate thread and a separate instance of the specified filter, so you will end up with sections of frames written in separate files.

elmarikon
8th October 2009, 11:40
Sorry!
I should have told you, I gave already tried all this:

1/
Setmtmode (2,x) # x=0 or number of cores (8?)
to be inserted between MergeRGB and ImmaWrite or line before Merge RGB; whatever working or quicker.
2/
or MT(...)
either
MT("""ImmaWrite(..., planar=true, type="raw")""")
or
MT("""
MergeRGB(ShowBlue("YV12"), Last, ShowRed("YV12"), "RGB24")
ImmaWrite(..., planar=true, type="raw")
""") # if working;

ImmaWrite won't work with the MT function (though it might with SetMTMode).
MT divides each frame into sections, with each part being processed by a separate thread and a separate instance of the specified filter, so you will end up with sections of frames written in separate files.

Sadly this is right...
with MT(""" Immagwrite ...""") you get images of 2048x520 instead of 2048x1080.

I have been trying SetMTMode (which I kindof use in every script) but it only speeds up the reading, but not the writing speed and I still have 10% of my processor(s) working...


but thanx for the quick answers!

Archimedes
29th October 2009, 00:56
A combination which also work: CORE_RL_*.dll's in the same directory, where the AviSynth script is and IM_MOD_RL_*.dll's in another directory. MAGICK_HOME user environment variable are set to the IM_MOD_RL_*.dll's directory.

iMaiden
3rd December 2009, 07:22
can someone please point me to the current version? The link on the first page no longer works.

thanks!

Wilbert
4th December 2009, 23:29
I will fix the links coming days. My old geocities page doesn't work anymore :)

Wilbert
5th December 2009, 16:17
http://www.wilbertdijkhof.com/immaavs_v141.zip
http://www.wilbertdijkhof.com/ImageMagick_dll.zip

Wilbert
6th December 2009, 13:35
New version out. See first post for changelog:

http://www.wilbertdijkhof.com/immaavs_v150.zip
http://www.wilbertdijkhof.com/ImageMagick-6.5.6_dll.zip

18fps
7th December 2009, 16:14
New version out. See first post for changelog:

http://www.wilbertdijkhof.com/immaavs_v150.zip
http://www.wilbertdijkhof.com/ImageMagick-6.5.6_dll.zip

Thank you for all your hard work!

Wilbert
7th December 2009, 20:21
Something spooky is going on. I can't load my plugin anymore and I have no clue why.

Recompiling doesn't help :confused: I will look at it this week.

Archimedes
8th December 2009, 15:51
The memory leaks when using the plugin in Fritz Photo are fixed now. With the old ImageMagick libraries there is no problem with your new version. Thanks for the updates.

18fps
10th March 2010, 10:56
I have a question about your great plugin.

If I open a sequence of dpx (16 bits per channel), they are converted to 8 bits per channel using dithering?

vucloutr
9th April 2010, 12:27
any update ? AvsP says tells me that there is no function ImmaWrite although the dll is in avisynth plugin directory.

Wilbert
9th April 2010, 18:19
any update ? AvsP says tells me that there is no function ImmaWrite although the dll is in avisynth plugin directory.
Hmm. Perhaps you are using the wrong plugin. Could you post a script, and load the plugin explicitly with LoadPlugin(...)?

@18fps,
If I open a sequence of dpx (16 bits per channel), they are converted to 8 bits per channel using dithering?
I think so. I've asked on their forum, but they didn't respond yet.

vucloutr
10th April 2010, 11:07
When I use LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\immaavs.dll") AvsP tells me that it is unable to load the dll.

edit:
just in case you need to know, i'm using:
win server 2008 x86 sp2
avisynth 2.5.8
immaavs_v150.zip
ImageMagick-6.5.6_dll.zip

there comes a question to my mind: where do i need to put those dlls of ImageMagick-6.5.6_dll.zip ?
i've extracted them into C:\Windows\System32 but i'm not 100% sure whether that is correct.

Wilbert
10th April 2010, 12:38
there comes a question to my mind: where do i need to put those dlls of ImageMagick-6.5.6_dll.zip ?
i've extracted them into C:\Windows\System32 but i'm not 100% sure whether that is correct.
Yes, that's correct.

Did you do set the MAGICK_HOME variable as well?
You need to set the MAGICK_HOME variable to the location of ImageMagick dll's (under Settings -> System -> Advanced -> Environment Variables -> Add MAGICK_HOME as a user variable)
Otherwise it won't work.

vucloutr
11th April 2010, 00:20
Woah.. I've tried a lot combinations now.. outcome is:

- MAGICK_HOME user variable didn't change a thing. I removed the user variable now and it still works.
- It works without LoadPlugin() as immavs.dll is in Avisynth's Plugin directory.
- It works without specifying the magick_home directory when calling ImmaWrite(). (..although MAGICK_HOME user variable is not set..)

my working .avs :
AVISource("my.avi")
ConvertToRGB32(matrix="Rec601", interlaced=false)
ImmaWrite(filename="test", start=100, end=109, type="gif", mode="Palette", animation=true, use_dither=false)

So what did the trick ?
I think the .xml files were missing the first time.
I just extracted the whole ImageMagick-6.5.6_dll.zip into C:\Windows\System32 overwriting all existing files and now it works.

Thanks for your input! :)

Wilbert
11th April 2010, 10:57
Ok, good to know!

So what did the trick ?
I think the .xml files were missing the first time.
Perhaps. You need those indeed.

foxyshadis
28th May 2010, 05:23
Wilbert, it looks like it won't load even with magic_home set because you have a load-time dependency on CORE_RL_MAGICK_.DLL, it attempts to load before any code runs at all (except DLLMain). You need to add /DELAYLOAD:CORE_RL_MAGICK_.DLL to the end of your linker command line. You might also put __HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"); right before MagickCoreGenesis.

Microsoft's example is:if (FAILED(__HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"))) {
printf ( "failed on snap load, exiting\n" );
exit(2);
}
that could easily beif (FAILED(__HrLoadAllImportsForDll("delay1.dll"))) {
env->ThrowError( "failed on snap load, exiting\n" );
}

Wilbert
28th May 2010, 18:41
Wilbert, it looks like it won't load even with magic_home set because you have a load-time dependency on CORE_RL_MAGICK_.DLL, it attempts to load before any code runs at all (except DLLMain). You need to add /DELAYLOAD:CORE_RL_MAGICK_.DLL to the end of your linker command line. You might also put __HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"); right before MagickCoreGenesis.
Could you elaborate a bit on this? I googled a bit but i'm still unsure what the deal is with this. What's load-time dependency and how do you know there is a load-time dependency on CORE_RL_MAGICK_.DLL. Do you always have this problem when loading external dll's in a plugin?

Also, without the delayload thingie, doesn't it load at all for you? Or doesn't it load if you set the magic_home setting? I noticed this setting didn't seem to do much :)

foxyshadis
29th May 2010, 05:50
It only loads if the dlls are already in the system path somewhere. If I put the folder I put them in (I have several versions so I keep them separate) in the system path, it loads fine, if not, it doesn't load at all and pops up a little message that it can't find the magick dll anytime I load up an avisynth script.

I can tell it has a dependency because I used the tool depends (http://www.dependencywalker.com/). Also because I saw it in the linker options in your .dsp. :p The tool'll tell you which dlls anything depends on, both immediately and on-demand. (Using /DELAYLOAD in the linker options makes it on-demand.) Alternately, you can use LoadLibrary yourself and load it from anywhere without relying on the system path.

Wilbert
29th May 2010, 18:44
Wilbert, it looks like it won't load even with magic_home set because you have a load-time dependency on CORE_RL_MAGICK_.DLL, it attempts to load before any code runs at all (except DLLMain). You need to add /DELAYLOAD:CORE_RL_MAGICK_.DLL to the end of your linker command line. You might also put __HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"); right before MagickCoreGenesis.
Ok, i needed to add delayimp.lib when using /DELAYLOAD.

However if I add

if (FAILED(__HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"))) {
env->ThrowError( "failed on snap load, exiting\n" );
}

Compiling results in:

F:\CompilingPlugins\Immaavs\immaavs.cpp(118) : error C2065: '__HrLoadAllImportsForDll' : undeclared identifier

Any hints on how to get his working?

Gavino
29th May 2010, 20:03
A quick Google search suggests you need to add
#include <delayimp.h>

However, the version of delayimp.h I have (from 2005) does not define __HrLoadAllImportsForDll, so you might need an updated Platform SDK.

Joachim Buambeki
30th May 2010, 11:21
Hi Wilbert,

thanks for this great plugin!
Is there a 64bit version the plug in available? If not, it would be nice if you could compile one. :)

Best Regards
David

Wilbert
5th June 2010, 13:25
Is there a 64bit version the plug in available? If not, it would be nice if you could compile one.
Sorry, i don't have a 64bit environment. Hopefully one of the 64bit gurus can do this?

Joachim Buambeki
12th June 2010, 23:00
Hi Wilbert,

too bad, I will ask in the Avisynth 64bit thread then.

I have another question:
At them moment I capture my timelapse footage in RAW and Jpeg, so I can render a quick preview from the Jpeg files shortly after the shooting with x264.
Since a RAW file contains a small (still ~3k) embedded Jpeg, why not use this to create a preview with Avisynth and x264?
Can ImageMagick extract the embedded Jepg from a .CR2 (Canon RAW) file without processing the RAW file in a time consuming way?
If not can you recommend an Imagereader that can do it? I believe I read somewhere that DCraw is capable of that.

Best Regards
David

Guest
13th June 2010, 01:38
Sorry, i don't have a 64bit environment. Hopefully one of the 64bit gurus can do this? Point me to the source code and I'll have a go at it.

Wilbert
13th June 2010, 15:54
sourcecode: http://www.wilbertdijkhof.com/immaavs_v150.zip

But i guess the ImageMagick dll's need to be compiled at 64bit too? If so i will package the ImageMagick source files for you.

@Joachim,
Can ImageMagick extract the embedded Jepg from a .CR2 (Canon RAW) file without processing the RAW file in a time consuming way?
If not can you recommend an Imagereader that can do it? I believe I read somewhere that DCraw is capable of that.
ImageMagick should be able to do that, but i never got that working in the plugin. You can DCraw or UFRaw to convert them to pnm first and import that in AviSynth (btw, ImageMagick uses DCraw too).

Guest
13th June 2010, 17:08
sourcecode: http://www.wilbertdijkhof.com/immaavs_v150.zip

But i guess the ImageMagick dll's need to be compiled at 64bit too? If so i will package the ImageMagick source files for you. Yes, please do.

Wilbert
13th June 2010, 17:42
https://docs.google.com/leaf?id=0B-UTPSkUYo6ZM2U2OWYxOTEtMTM3Ni00YmEwLWE2MjktYzVjMWI2N2U2N2U4&hl=nl

Some of my notes:

1) build configure.exe using configure.dsw under F:\CompilingPlugins\ImageMagick-6.5.8\VisualMagick\configure
3) run configure.exe and select 'Dynamic Multi-threaded runtimes' and uncheck 'Generate Visual Studio 7 format' (since i'm using VC6).
(leave the "X11 stubs ... box" checked.)
click on 'edit "magick_config.h"' and change
#define MAGICKCORE_QUANTUM_DEPTH 16
to
#define MAGICKCORE_QUANTUM_DEPTH 8
and save it.
4) build the libs (rebuild all - release version) using VisualDynamicMT.dsw under F:\CompilingPlugins\ImageMagick-6.5.8\VisualMagick
5) added the library module CORE_RL_magick_.lib in MSVC under the link tab.
6) added F:\COMPILINGPLUGINS\IMAGEMAGICK-6.5.8 to 'Directory -> Include files' (under Tools -> Options).
7) added F:\COMPILINGPLUGINS\IMAGEMAGICK-6.5.8\VISUALMAGICK\LIB to lib directories (Tools -> Options).
ImageMagick is not compilable with the free edition of VC8 (Enterprise), because it comes without the MFC stuff. Get the professional edition.

Joachim Buambeki
21st June 2010, 21:43
Hi Wilbert,

ImageMagick should be able to do that, but i never got that working in the plugin. You can DCraw or UFRaw to convert them to pnm first and import that in AviSynth (btw, ImageMagick uses DCraw too).I did not know that ImageMagick is based on DCRaw, interesting.
So you say that Imagemagick is capable of doing what I want to do, but it does not work for whatever reason? I do not fully understand how the Avisynth plugin communicates with DCRaw, is it directly or through middleware?
As far as I understood it, there is your plugin, that is a "frontend" for Imagemagick, which is using DCRaw to get acces to raw files?!
If it is not too much ask, could you contact the developers of Imagemagick, so they can implement the function?

Converting the files with DCRaw first would be an extra step I really would like to avoid to get a fast preview of my timelapse sequence directly after the shot.

Best Regards
David

tin3tin
23rd June 2010, 09:13
Wilbert, it looks like it won't load even with magic_home set because you have a load-time dependency on CORE_RL_MAGICK_.DLL, it attempts to load before any code runs at all (except DLLMain). You need to add /DELAYLOAD:CORE_RL_MAGICK_.DLL to the end of your linker command line. You might also put __HrLoadAllImportsForDll("CORE_RL_MAGICK_.DLL"); right before MagickCoreGenesis.
Any progress on this?

Wilbert
3rd July 2010, 16:53
As far as I understood it, there is your plugin, that is a "frontend" for Imagemagick, which is using DCRaw to get acces to raw files?!

Yes, it should work like this. But luckely i got it to work!!! I have to admit loading those formats take a while, but at least it should work.

Try this build (http://www.wilbertdijkhof.com/ImmaRead_raw_camera_support.zip) (put CORE_RL_MAGICK_.DLL in system folder). Fixes:

* load-time dependency on CORE_RL_MAGICK_.DLL removed.
* raw camera support (DCR DNG ERF MEF MRW NEF ORF PEF RAF RAW SR2 X3F).

CR2 and 3FR don't work yet. I need to compile and patch Dcraw with JPEG support (and recompile ImageMagick and Immaavs after that).

Joachim and tin3tin could you try this version? In the mean time i will add CR2 support and make a new official package.

@neuron2,
Did you get anywhere with 64bit support for me?

tin3tin
3rd July 2010, 17:42
Thanks. I've placed CORE_RL_magick_.dll in the system32 folder.

This script:
LoadPlugin("C:\\Users\\tin2tin\\Desktop\\Immaavs\\immaavs.dll")
Immaread("C:\\Users\\tin2tin\\Desktop\\Immaavs\\Soccer_ball.png", magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs\\")

Throws this error:
Evaluate: System exception - 0xc06d007e

Is relative paths suported?

Wilbert
3rd July 2010, 17:52
Is relative paths suported?
I don't believe so. This magick_home setting doesn't do anything, although it shouldn't result in a crash.


LoadPlugin("C:\Users\tin2tin\Desktop\Immaavs\immaavs.dll")
Immaread("C:\Users\tin2tin\Desktop\Immaavs\Soccer_ball.png")

Does this work?

tin3tin
3rd July 2010, 21:56
Without the 'magick_home setting' - it says:
ImmaRead: you haven't set the Magick_Home variable and you didn't provide it as argument!

I must add that I haven't added the plugins to the Avisynth plugin folder - as I guess this is an attempt to get the plugin to run from user specified folders(as home). Did I misunderstand this?

Wilbert
3rd July 2010, 22:18
Ok, the magick_home setting should be working (contrary to what i said above). But let's try something else first:

Could you copy the ImageMagick dll's (and xml files) (from http://www.wilbertdijkhof.com/ImageMagick_dll_20100703.zip) to your system folder?

Also set magick_home = "C:\\WINNT\\system32" as a user variable in your system settings (it should override the equivalent setting in the plugin). Does the second script work now?

tin3tin
3rd July 2010, 22:30
If I add all the dlls to the system32 folder and run this script, it works:

LoadPlugin("C:\Users\peter\Desktop\Immaavs\immaavs.dll")
Immaread("C:\Users\peter\Desktop\Immaavs\Soccer_ball.png", magick_home="C:\\WINNT\\system32")
But it didn't work without setting the magick_home variable - Now I've run it succesfully once -I can remove the magick_home and it still works!?

Would it be possible eventually to run it without adding dll's to the system32 folder?

Wilbert
3rd July 2010, 22:42
Ok, good.
But it didn't work without setting the magick_home variable
You can get it to work in two ways:

1) set magick_home="C:\\WINNT\\system32" in the environmental variables (as a user variable) in your control panel. Put all the dlls in that folder. Use the script:


LoadPlugin("C:\Users\peter\Desktop\Immaavs\immaavs.dll")
Immaread("C:\Users\peter\Desktop\Immaavs\Soccer_ball.png")


2) set magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs" (or whatever) as option in your script. Put all the dlls in that folder. Remove the magick_home variable in your environmental variables if you put it there. Use the script:


LoadPlugin("C:\Users\peter\Desktop\Immaavs\immaavs.dll")
Immaread("C:\Users\peter\Desktop\Immaavs\Soccer_ball.png", magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs")


Perhaps option 2 didn't work because your forgot to put ImageMagick dlls in your specified folder: "C:\\Users\\tin2tin\\Desktop\\Immaavs"?

tin3tin
3rd July 2010, 22:59
Now I removed all the dlls from system32, and placed them in another folder and now it seems to work. I was simply missing all the additional dlls. Sorry.

tin3tin
4th July 2010, 07:05
On relative paths:
LoadPlugin("immaavs.dll")
Immaread("Soccer_ball.png", magick_home="")
This works now. So I guess that relative paths now works. Great :)

Gavino
4th July 2010, 12:50
LoadPlugin("C:\\Users\\tin2tin\\Desktop\\Immaavs\\immaavs.dll")
Immaread("C:\\Users\\tin2tin\\Desktop\\Immaavs\\Soccer_ball.png", magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs\\")
What's with the double backslash ("\\")?
This isn't 'C' - backslash is not treated specially by the Avisynth parser (except for line continuation).

And yet... both LoadPlugin and AviSource (the only ones I have tried so far) seem to work with double backslashes in the file names.
How come? :confused:

Joachim Buambeki
7th July 2010, 13:09
Hi Wilbert,
Joachim and tin3tin could you try this version? In the mean time i will add CR2 support and make a new official package.I will report my findings soon, just been a bit busy in the last days. Thank you for your update!

Best Regards
David

Wilbert
17th July 2010, 21:18
New version out. See first post for changelog:

http://www.wilbertdijkhof.com/Immaavs_v151.zip
http://www.wilbertdijkhof.com/ImageMagick-6.5.8_dll.zip

diffid
26th July 2010, 22:02
Thanks for a great script.

Yellow_
26th July 2010, 22:04
Hi

Checking the output from:

LoadPlugin="ffms2.dll"
LoadPlugin="immaavs.dll"

c = FFmpegSource2("path\to\.MOV").ConvertToRGB24(matrix="PC.709", interlaced=false)

Immawrite(c, "path\to\writeto\", start=0, end=10, type="tiff", magick_home = "C:\WINDOWS\system32")

In ImageJ, it says that Imagemagick is compiled Q8? For anyone wishing to output 16bit tiff's for example should IM be compiled with quality setting 16 or 32?

Is there a chance of Openexr output? IM supports it I believe?

Thanks for your script, it simplifies a more manual process I previously used. :-) to go from 8bit video to 16bit tiffs / exrs in a two stage process.

Following the common talk about upping 8bit video to 16bit ready for image manipulation and smudging the pixels about gently with a bit of temporal/spacial denoise to generate some discrete additional data in the 16bit files is this something that can be done?

Wilbert
27th July 2010, 18:18
In ImageJ,
What's 'ImageJ'?

In ImageJ, it says that Imagemagick is compiled Q8? For anyone wishing to output 16bit tiff's for example should IM be compiled with quality setting 16 or 32?

Yes, the ImageMagick libraries are compiled at Q8. The Q stands for quantum :) For 16bit libraries you need to leave the line '#define MAGICKCORE_QUANTUM_DEPTH 16' in magick_config.h. But be aware that AviSynth itself doesn't support 16 bit yet.

Is there a chance of Openexr output? IM supports it I believe?
Nope. I tried to include exr support once in ImageMagick, but without any luck. It should be supported in ImageWriter though (in AviSynth v2.60; latest csv-version).

Following the common talk about upping 8bit video to 16bit ready for image manipulation and smudging the pixels about gently with a bit of temporal/spacial denoise to generate some discrete additional data in the 16bit files is this something that can be done?
I guess you want to add some noise? There are several plugins which can do this.

Yellow_
27th July 2010, 21:31
What's 'ImageJ'?

ImageJ is a Java based image / avi analysis app that I like to use, quite extensive plugins, not as many as AVISynth though. :-)

Yes, the ImageMagick libraries are compiled at Q8. The Q stands for quantum :) For 16bit libraries you need to leave the line '#define MAGICKCORE_QUANTUM_DEPTH 16' in magick_config.h. But be aware that AviSynth itself doesn't support 16 bit yet.

Ok, I used the pre built binaries, as I'm on Linux + Wine, so disregarded building from source, although compiled IM for Linux with Q16. Is there any chance of a 16bit binaries, there have been a few mentions on the thread based on the same 8bit to 16bit process.

Nope. I tried to include exr support once in ImageMagick, but without any luck. It should be supported in ImageWriter though (in AviSynth v2.60; latest csv-version).

Too bad, I keep a look out for 2.60. :-)

I guess you want to add some noise? There are several plugins which can do this.

Ok, I'll try some out.

IM offers a couple of noise types as well I think, available in 16bit mode too I guess with the Q16 build. Are you considering being able to use IM commands at all, before the final write out?

Yellow_
29th July 2010, 22:35
Ok, I found the IM .dll's for Q16 from ImageMagicks site, version 6.6.3, substituted the Q8 with them and tried some scripts that worked with the 8bit version. But VirtualDubMod and VirtualDub 1.9.9, both throw up the same error:

CAVIStreamSynth: System exception - Access Violation at 0x326ce98, reading from 0x6f64ee9

Any ideas?

I've also tried the 6.6.3, Q8 build from IM site and that gives same error in VDubs and I can't find a 6.5.8 Q16 build. :-(

Wilbert
30th July 2010, 18:18
I will build it on Sunday, but you will probably get the same error. The problem (i think) is that it tries to open the image as 16bit and 16bit is not yet supported (in any colorformat) in AviSynth.

I've also tried the 6.6.3, Q8 build from IM site and that gives same error in VDubs
Did you also recompile Immaavs? Anyway it's described in the documenation how to do all of that.

Yellow_
29th August 2010, 14:34
Wilbert, sorry long time in reply. No I didn't recompile Immaavs, I'm on Linux and haven't got my head round MingW yet.

Did you find time to build IM and Immaavs for 16bit on the Sunday?

Terranigma
10th September 2010, 20:51
You can get it to work

2) set magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs" (or whatever) as option in your script. Put all the dlls in that folder. Remove the magick_home variable in your environmental variables if you put it there. Use the script:


LoadPlugin("C:\Users\peter\Desktop\Immaavs\immaavs.dll")
Immaread("C:\Users\peter\Desktop\Immaavs\Soccer_ball.png", magick_home="C:\\Users\\tin2tin\\Desktop\\Immaavs")


Perhaps option 2 didn't work because your forgot to put ImageMagick dlls in your specified folder: "C:\\Users\\tin2tin\\Desktop\\Immaavs"?


Are you sure that's the only case? I've been trying for about an hr to get ImmaWrite to work (using the plugins/dll's provided at the link in the first post), which, according to the above example, should work.


I'm trying to load plugin like so:

dv = "C:\Program Files\AviSynth 2.5\Video Index\Escaflowne.d2v"
rf = "C:\Program Files\AviSynth 2.5\Images\Escaflowne\"
mh = "C:\Program Files\AviSynth 2.5\plugins\ImageMagick\"
vid=mpeg2source(dv,info=0)
ImmaWrite(vid,rf,5,5,"raw",magick_home=mh)

and i get the same error (0xc06d007e) tin3tin was getting. :confused:

Wilbert
11th September 2010, 23:14
Did you find time to build IM and Immaavs for 16bit on the Sunday?
Sorry, i can't get it to work. I changed

#define MAGICKCORE_QUANTUM_DEPTH 8

to

#define MAGICKCORE_QUANTUM_DEPTH 16

in the magick-config.h file and recompiled everything. If I open an image with IMDisplay.exe (or use convert.exe to convert something) it crashes (both are utilities of ImageMagick itself). Perhaps i should try a newer version of ImageMagick.

@Terranigma,
I don't know. Does it work if all the dll's are in your system folder, or is that not working either?

Terranigma
12th September 2010, 23:02
@Terranigma,
I don't know. Does it work if all the dll's are in your system folder, or is that not working either?


No, I haven't tried that method, but i'm sure it'll work. The issue with moving the dll's to my system folder for me, is that I don't like having a lot of DLL's in a directory where dll's could pose potential security issues.

Now i'm not trying to say that these dll's are infected or anything, but I feel that the less dll's in the system directory the better (specifically when trying to manually sort out infected dll's if, or whenever there's an infection). :p

Anyways, I found an alternative solution in just using ImageWriter and ImageSource to export/import images in the ebmp format. :o

Wilbert
13th September 2010, 18:28
No, I haven't tried that method, but i'm sure it'll work. The issue with moving the dll's to my system folder for me, is that I don't like having a lot of DLL's in a directory where dll's could pose potential security issues.

I understand. It might help diagnose us what the problem is. If it doesn't work there, there must be some other issue.

Terranigma
13th September 2010, 21:15
I understand. It might help diagnose us what the problem is. If it doesn't work there, there must be some other issue.

OK, then i'll try as requested and report back.

Terranigma
15th September 2010, 02:51
Still not working. :devil:
Perhaps it'll work if I actually installed the ImageMagick program from it's official website. Btw, looks like you need to update the ddl's.

Wilbert
15th September 2010, 20:42
Perhaps it'll work if I actually installed the ImageMagick program from it's official website.
No, that won't matter. Please, post your exact script and set magick_home = "C:\\WINNT\\system32" (or whatever your system folder is) in: "Control Panel -> System -> Advanced -> Environment Variables".
Put all files in http://www.wilbertdijkhof.com/ImageMagick-6.5.8_dll.zip in your system folder.

Yellow_
1st March 2011, 23:49
Is it possible to output images with AdobeRGB gamut. For example using yCMS 3D LUT to convert xvYCC video to AdobeRGB and then write that out to png with AdobeRGB gamut?

sebastian___
8th March 2011, 13:33
I'm trying to use this as an alternative to ImageSource() for reading a image sequence like this : file 00010.tga file 00011.tga file00012.tga and so on.

ImageSource() works with Adobe Media Encoder CS4 but has an awkward way for describing the input file like file%05d.tga or so, and also the first and last frame numbers are mandatory.

CoronaSequence doesn't have those requirements and has also wild cards. but it works in AME CS4 only with jpg's and not tga's.

Can I use Immaavs with wildcards ?
Do I have to copy those dll's in System folder if I don't plan to use processing ? I will just use this for reading.

Wilbert
8th March 2011, 14:32
Can I use Immaavs with wildcards ?
Yes, have a look at the examples in the documentation (contrary to CoronaSequence it can't scan subfolders though).

Do I have to copy those dll's in System folder if I don't plan to use processing ? I will just use this for reading.
Yes, including the *.xml files.

@Yellow_,

Is it possible to output images with AdobeRGB gamut. For example using yCMS 3D LUT to convert xvYCC video to AdobeRGB and then write that out to png with AdobeRGB gamut?
I don't know much about gamuts. I'm not sure whether that's supported in ImageMagick itself. I will look at it when i release a new version (some day ...).

sebastian___
16th March 2011, 14:21
I didn't got the chance yet to test Immaavs.

And a little off-topic but I thought of something. From the corona sequence help :
"The output format is always RGB32" .

Maybe that's the reason why CoronaSequence works in CS4 with jpg's but not with tga's. Because JPG can only be RGB24 and maybe Adobe CS4 only likes RGB24.
Even tough CoronaSequence output format is always RGB32 can I convert it to RGB24 before the output ?

So it would be :
CoronaSequence -> RGB32 -> RGB24 -> AdobeCS4

EDIT : I found out the problem. In fact with tga, CoronaSequence doesn't work in any player or software. I tried with bmp and worked. Then I tried again with TGA without the RLE compression and it works. So it's a bug. CoronaSequence doesn't support TGA with RLE compression. That's a shame because the RLE is lossless and faster than without the compression.

Dogway
24th March 2011, 11:29
I want to test this plugin because Im having quality problems with ImageSource, but I get the same error as tin3tin and Terranigma: (0xc06d007e)

Wilbert
24th March 2011, 19:51
I want to test this plugin because Im having quality problems with ImageSource, but I get the same error as tin3tin and Terranigma: (0xc06d007e)
tin3tin got it working apparently. See http://forum.doom9.org/showthread.php?p=1414204#post1414204 and his reply. Did you do that too (ie put all dll and xml files in your system folder)?

Dogway
25th March 2011, 02:08
I didnt want to throw everything to system32, but ok, it worked. It decodes with the same quality as ImageSource, which I dont know, but compared to Photoshop seems to weight less when saved as .png.

BlueCup
28th June 2011, 04:04
When loading RAW files (NEFs for example) is it possible to alter the RAW information as is done in Camera RAW for Photoshop?

elmarikon
17th August 2011, 19:41
Hi again!

For me it would be huuuuge help, if Immaavs could work with icc profiles, like Image/GraphicsMagick does...
Do you see any chance, this will be implemented?



All the best from Berlin!

Wilbert
17th August 2011, 19:46
For me it would be huuuuge help, if Immaavs could work with icc profiles, like Image/GraphicsMagick does...
Do you see any chance, this will be implemented?
Sorry, i forgot to reply. I guess it's possible, but i'm not sure. I will look at it, but that will take a while (i've not much time for doing AviSynth related stuff).

martin53
5th October 2012, 18:30
Did anyone successfully test Immaavs_v151 together with avisynth_2.60MTalpha_SEt_120828?

I get with W7/32 and this script - and of course the dlls in C:\Avisynth\plugins\ImageMagick

Colorbars(pixel_type="RGB32")
ImmaWrite("000000.tif", 0, 0, magick_home="C:\\AviSynth\\plugins\\ImageMagick")

on frame #0:
"Avisynth: unknown exception 0xC06D007E at 0x0000D36F in C:\Windows\system32\KERNELBASE.dll (_immawrite.avs, line 2)"

4evrplan
10th October 2012, 17:24
I got it working on my system, but if I use a wild card in the file name ("d:\Users\myUserName\Desktop\sky\*back*.jpg"), I get an error:

Avisynth open failure:
Avisynth: script open failed!

And, the wildcard support is the whole reason I'm not just using imageSource.

Wilbert
10th October 2012, 18:05
I got it working on my system, but if I use a wild card in the file name ("d:\Users\myUserName\Desktop\sky\*back*.jpg"), I get an error:
Mmm, the wildcards should be working (although i never tested it with two wildcards). Could you provide your full script, then i can look at it next week.

4evrplan
10th October 2012, 18:29
Mmm, the wildcards should be working (although i never tested it with two wildcards). Could you provide your full script, then i can look at it next week.

It's a work in progress, but...

back = immaread("d:\Users\myUserName\Desktop\sky\*back*.jpg").ConvertToRGB32()
front = ImageSource("d:\Users\myUserName\Desktop\sky\front.jpg",0,0).ConvertToRGB32()
left = ImageSource("d:\Users\myUserName\Desktop\sky\left.jpg",0,0).ConvertToRGB32()
right = ImageSource("d:\Users\myUserName\Desktop\sky\right.jpg",0,0).ConvertToRGB32()
top = ImageSource("d:\Users\myUserName\Desktop\sky\top.jpg",0,0).ConvertToRGB32()
m = ImageSource("d:\Users\myUserName\Desktop\sky\mask.bmp",0,0)

# Create a composite image with the top patch in the center.
ul = left.Turn180().Layer(back.TurnRight().Mask(m))
br = front.TurnLeft().Layer(right.Mask(m))
m = m.TurnLeft()
ur = right.Turn180().Layer(back.TurnLeft().Mask(m))
bl = front.TurnRight().Layer(left.Mask(m))

StackVertical(
\ StackHorizontal(ul,back.Turn180(),ur),
\ StackHorizontal(left.TurnRight(),top,right.TurnLeft()),
\ StackHorizontal(bl,front,br)
\ )

ConvertToRGB24()
ImageWriter("d:\Users\myUserName\Desktop\sky\upper",type="bmp")

# Create a composite image with the bottom patch in the center.
ur = left.Layer(back.TurnRight().Mask(m))
bl = front.TurnLeft().Layer(right.Turn180().Mask(m))
m = m.TurnRight()
ul = right.Layer(back.TurnLeft().Mask(m))
br = front.TurnRight().Layer(left.Turn180().Mask(m))

StackVertical(
\ StackHorizontal(ul,back,ur),
\ StackHorizontal(right.TurnLeft(),top.BlankClip(),left.TurnRight()),
\ StackHorizontal(bl,front.Turn180(),br)
\ )

ConvertToRGB24()
ImageWriter("d:\Users\myUserName\Desktop\sky\lower",type="bmp")


And, the source images are here (http://www.3delyvisions.com/sky2.zip), but I've changed the names of them to "back.jpg", "front.jpg", "left.jpg", "right.jpg", and "top.jpg", as appropriate.

I've tested it with no wildcard (works), wildcard at the front (same error), wildcard at the back (same error), and two wildcards (same error).

I'm using Win 7 Pro 64 bit, and I've got the ImageMagick files copied to C:\Windows\SysWOW64 and MAGICK_HOME pointing to the same place (no backslash at the end).

Oh, and "mask.bmp" is just a 512x512 32 bit image (a8 r8 g8 b8) with the upper right half black and fully transparent and the lower left half white and fully opaque.

EDIT: There is at least one bug in this script; I shouldn't be calling imagewriter more than once. The new version combines separate "patches" consecutively into a single clip and calls imagewriter on the combined clip.

Wilbert
16th October 2012, 14:37
I didn't try your whole script, but simply

immaread("F:\Temp\*back*.jpg")

loads your picture (oback7.jpg) fine for me. Could you try that single line script too?

I have no idea how to find out what's wrong (must be some Win 7 specific stuff), other than debugging it. But the problem is that i don't have Win 7 installed.

Are there any Win 7 users who wants to run it through a debugger to find out what's wrong?

4evrplan
16th October 2012, 17:55
I didn't try your whole script, but simply

immaread("F:\Temp\*back*.jpg")

loads your picture (oback7.jpg) fine for me. Could you try that single line script too?

I got the same results with the single line script.

Iron_Mike
25th March 2016, 02:19
Hi guys,

I have a problem reading image sequences via ImmaRead... single images load just fine.

Setup: AviSynth 2.6, ImmaAVS 1.5.1, AVFS and Pismo File Mount - on Win 8.1 x64

here's an example script:

# this works just fine
LoadPlugin("D:\ImmaAVS\Immaavs_v151\Release\immaavs.dll")
ImmaRead("D:\test.jpg", magick_home="C:\Windows\SysWOW64")

# this crashes Pismo File Mount
LoadPlugin("D:\ImmaAVS\Immaavs_v151\Release\immaavs.dll")
ImmaRead("D:\*.jpg", magick_home="C:\Windows\SysWOW64")

What am I doing incorrect ?

I tried various syntaxes for the image sequences, all crash PFM... single images are not a problem.

As a side note, if I put the ImageMagick dll files in any other folder other than C:\Windows\SysWOW64, I get an file not found error for the image file, as has been reported in another thread.

Thank you for your help !!!

Wilbert
13th August 2016, 17:21
Sorry for the very late reply. I fixed the wildcard problems:

* http://www.wilbertdijkhof.com/Immaavs_v152.zip
* http://www.wilbertdijkhof.com/ImageMagick-6.5.8b_dll.zip (put all files in the package in your system folder)

Let me know if you still have issues with it. Note this will be the last version that will work with AviSynth v2.5.8.

18fps
19th August 2016, 11:12
Hi Wilbert, thank you for the new release.
I'm getting an error:
"Delay-load Module Not Found". What should I check? I'm on Windows 7 64bit.

Wilbert
19th August 2016, 13:35
Hi Wilbert, thank you for the new release.
I'm getting an error:
"Delay-load Module Not Found". What should I check? I'm on Windows 7 64bit.
It means that it can't find one of the dlls. Did you put all the files in the zip package (dlls and xmls) in your system folder (thus in C:\Windows\SysWOW64).

See http://forum.doom9.org/archive/index.php/t-157889.html for a similar problem.

You will also need the Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package (https://www.microsoft.com/en-us/download/details.aspx?id=26368).

18fps
19th August 2016, 14:37
It means that it can't find one of the dlls. Did you put all the files in the zip package (dlls and xmls) in your system folder (thus in C:\Windows\SysWOW64).

See http://forum.doom9.org/archive/index.php/t-157889.html for a similar problem.

You will also need the Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package (https://www.microsoft.com/en-us/download/details.aspx?id=26368).

Thank You. I already had the redistributable and the dlls, I'll try later by re-starting the PC, I seem to remember it was necessary to do that.

18fps
21st August 2016, 10:27
Re-starting the pc didn't change nothing. So what I did was to copy the dll's contained in the older immaavs folder that I kept (including all the IM_MOD... dll's not included in the new ImageMagick-6.5.8b_dll.zip) and then it worked.

Wilbert
21st August 2016, 14:49
Re-starting the pc didn't change nothing. So what I did was to copy the dll's contained in the older immaavs folder that I kept (including all the IM_MOD... dll's not included in the new ImageMagick-6.5.8b_dll.zip) and then it worked.
Oops sorry about that. I didn't include all libraries in the package. Could you redownload that zip-file and try again? (It might be that the existing IM_MOD... dll's that you have are old ones.)

18fps
21st August 2016, 17:03
Thank You!

On other note: have you thought about modifying your plugin to input high bit depth images on avisynth+? That would be great!

Wilbert
21st August 2016, 17:07
Once the functionality gets stable i will look at it. I first want to update ImageMagick, update raw camera support (that is dcraw) and add exr support.

Wilbert
18th December 2016, 00:48
New version:

Changelog in v1.60:

* updated to AVISYNTH_INTERFACE_VERSION = 6 (so the plugin requires AviSynth v2.60).
* updated ImageMagick libraries to v7.0.2-10 (ported code to MagickCore API 7.0).
* ImmaRead: grayscale images are opened as Y8, non-grayscale images as RGB24 (or RGB32 if there is an alpha channel present).
* ImmaWrite: added dithering methods "Riemersma" and "FloydSteinberg".
* ImmaWrite: added the new 2.6 colorformats for raw/y4m.
* ImmaWrite: the color option is changed to color_max.
* ImmaWrite: added quality and sampling_factor options for jpeg.
* ImmaWrite: added the compression option.

Enjoy ;-)

download:
* plugin: http://www.wilbertdijkhof.com/Immaavs_v160.zip
* ImageMagick dll's: http://www.wilbertdijkhof.com/ImageMagick-7.0.2_dll.zip (copy the dll's and xml files to your 32-bit system folder)

Alex-Kid
12th June 2018, 06:31
Hi Wilbert, I tried installing v1.60 (plugin + dll's v7.0.2) but I couldn't get it to work. It says "There is no function named immaread" when trying to read a PNG file. I had to go back to v1.51, the last one I used. Do you (or anybody) know if it's working? (There are no new posts since you announced new version).

I am on Windows 10 Pro 64-bits.

StainlessS
12th June 2018, 08:40
I am on Windows 10 Pro 64-bits.
You are probably gonna be asked what version Avisynth you are using (and bittage).

EDIT: Post output of

AvsMeter -avsinfo -l

Alex-Kid
12th June 2018, 21:39
Thanks StainlessS, I knew I forgot something: Avisynth v2.60 ST 32-bit.

I'm going to post that AvsMeter output later, when I get home.

----------EDIT----------

Avsmeter output is too big for the forum, I uploaded to pastebin (https://pastebin.com/A5eTJrAp).

Wilbert
16th June 2018, 20:45
I don't know what the problem is. But you have tons of files in your plugin folder and most of them are not even AviSynth plugins.

You might start by leaving only immaavs.dll in your plugin folder. Did you also copy the imagemagick dll's and xml's in your system folder (SysWOW64)?

Groucho2004
16th June 2018, 21:24
700+ files in your plugin directory - I was about to start pointing out the files that really don't belong there, duplicates, etc. but this is just silly. As Wilbert suggested, remove everything from the directory (make a backup if you wish) and add plugins as needed.

ingoldie
8th May 2019, 16:15
When I try to open lena_std.tif with ImmaRead("C:\lena_std.tif")

I get the following error message

"ImmaRead:you haven't set the MAGICK_HOME variable and you didn't provide it as argument!"

How can I solve this problem?


For the original as a TIFF image:http://www.lenna.org/

StainlessS
8th May 2019, 16:32
First page of thread
You need the ImageMagick dll's in order to be able to use this plugin. They should be copied to some folder (any folder will do). You need to set the MAGICK_HOME variable to the location of ImageMagick dll's (under Settings -> System -> Advanced -> Environment Variables -> Add MAGICK_HOME as a user variable), or you need to provide it using the magick_home argument. Thus for example, magick_home = "C:\\WINNT\\system32".

ingoldie
8th May 2019, 16:49
Like this?

ImmaRead("C:\lena_std.tif", magick_home="C:\Windows\SysWOW64")

ingoldie
8th May 2019, 17:07
If yes, now I'm getting

"ImmaRead:couldn't open picture file:severity=1ef, reason=RegistryKeyLookupFailed 'CoderModulesPath' @error/module.c/GetMagickModulePath/670, description=(null)" error message

StainlessS
8th May 2019, 18:20
Like this I think (untested)
https://i.postimg.cc/ZWJTSD18/Untitled.png (https://postimg.cc/ZWJTSD18)
EDIT: Oops sorry, posted image is wrong, should be in USER VARIABLES(top one) not System variables(bottom one).

Thus for example, magick_home = "C:\\WINNT\\system32".
NOTE, Wilbert used double backSlash, if dont work with single, then try double backslash.

ingoldie
10th May 2019, 13:01
It's not working.I'm still getting the same

"ImmaRead:couldn't open picture file:severity=1ef, reason=RegistryKeyLookupFailed 'CoderModulesPath' @error/module.c/GetMagickModulePath/670, description=(null)" error message

StainlessS
10th May 2019, 14:19
Oops sorry,posted image is wrong, should be in USER VARIABLES(top one) not System variables(bottom one).
(but I think should have worked ok after a reboot when in system variables - did you reboot ?)

StainlessS
10th May 2019, 16:19
I'm getting exact same error as Ingoldie.

Search for "CoderModulesPath" gives this solution,
https://www.imagemagick.org/discourse-server/viewtopic.php?t=26856

Looks like you need to have imagemagick installed else dll's dont work (solution in above link).

Also, what you supposed to do with CORE_RL_magick_.dll, I dont see it mentioned, but it is clearly needed.

martin53
7th January 2022, 20:32
Just for the record (i.e. maybe myself with my next clean OS install) - I set up immaavs to open .pdf file format today, struggled quite bad with it (advice on old problem reports helped a lot) and give a summary for today's recent versions here (I hope).
N.B.: my AviSynth install is 32 bit on a 64 bit Windows 10, I think this is convenient because the pile of old plugins, some of them lacking source code, is not completely available as x64 builds.

* Fetched the plugin itself (v160) from the 1st post of this thread
* Same with the 7.0.2 ImageMagick dlls, but did not copy them into the system32 OS folder
* Extracted the immaavs\Release folder content of the plugin .ZIP to an appropriate folder (a subfolder of the plugin autoload folder in my case, but I don't think this matters)
* Extracted the complete 'ImageMagick-7.0.2_dll' folder content of the ImageMagick .ZIP to the same imaavs\Release folder (!)
* Only a portable ImageMagick version is installed (more specific, there is another old, incompatible one with Fritz Photo and there was a broken environment variable pointing to a deleted OpenShot installation)
* Added MAGICK_CODER_MODULE_PATH=<abovementioned Release folder> to the system environment variables
= I think this means ImmaAvs does not need an ImageMagick installation
* logged of and on again because AvsPmod did not see the variable after close/restart, but later understood that close/restart of my Explorer replacement file manager is sufficient, from where I open AvsPmod
* found a 32 bit Ghostscript version 9.53.3 on the computer, which is outdated but shows compatible - here again, there are several ones packaged with various freeware SW products, which does not matter
* added the bin folder of that Ghostscript to the system %PATH% (remember to make it visible to a new AviSynth process)
* use ImmaRead(..., magick_home=<abovementioned Release folder>) with success.

(density is the DPI value for the pdf files. 100 is quite blocky like 1st generation fax - but yes, on the other hand, AvsPmod is challenged with 2480x3500px frames)