rjp74 |
I am trying to use the map script and need to know the the Image size as I need the ratio of width to height. I expected this to be the OUTPUT_WIDTH and OUTPUT_HEIGHT params. The problem I have is that my image is 1229 x 706 pixels but these params return 96 and 96. Anybody any idea how to get the correct image sizes please?
|
|||
Posted: February 19, 2011 6:26 am | ||||
Sphinx.
![]() |
So you are using the correct global variables. The error must be elsewhere in your script.. |
|||
Posted: February 22, 2011 1:59 am | ||||
rjp74 |
My script is only one line long:
function get_sample(x, y) error(OUTPUT_WIDTH .. ", " .. OUTPUT_HEIGHT) end; so I don't think the trouble is with the script. The variables simply return the incorrect values. |
|||
Posted: February 22, 2011 4:40 am | ||||
Sphinx.
![]() |
Ah, well thats because you see the error msg from the initial thumbnail rendering pass (change the thumbnail size and the error output values change too).
Perhaps FF should not allow error outputs during thumbnail rendering. Try returning the values instead and inspect the large preview with the eyedropper: function get_sample(x, y) return OUTPUT_WIDTH, OUTPUT_HEIGHT, 0, 0 end; Now you should see the correct values. |
|||
Posted: February 22, 2011 9:57 am | ||||
rjp74 |
If I change the thumbnails to "large" then the value changes to 128. However, the spec says:
So I expect these 2 values to reflect the loaded image size. The preview window (upper left) has the correct dimensions. The code does not. Thank you for your code idea - but I don't understand how your code helps. You have the alpha set to 0. If I change that to 1 then I get a pure yellow output. What I don't get to see - either in preview mode or in the final render are the correct values. It seems to be a bug in the implementation. I have not found how to get it to work as documented. |
|||
Posted: February 22, 2011 11:34 am | ||||
Sphinx.
![]() |
I agree it is not very logical that thumbnail rendering steps can trigger error / print messages.
But it is not a problem really. What I tried to show you is that at the time your script is executed for processing your input image, the OUTPUT_WIDTH and OUTPUT_HEIGHT variables will contain the correct values. Think of it this way: before your input image is processed, FF "borrows" your script for rendering the thumbnail. They use their own input image, the thumbnail, and global variables inspected at this point reflects that image. When you call error, you interrupt the rendering at the thumbnail rendering pass. About my script: Don't be fooled by the visual output - just try it and then click the eyedropper tool above the preview (in editor mode) and click somewhere on the preview field with the eyedropper. Red channel will show you the value of OUTPUT_WIDTH, green channel will show you the value of OUTPUT_HEIGHT. The values at this point reflects your input image size. Returning variables through r,g and b result is recommended for temporary variable inspection. |
|||
Posted: February 23, 2011 4:44 am | ||||
GMM
Moderator
Posts: 3491 |
Sphinx is right, except that thumbnail rendering is performed simultaneously to the input image processing. The Lua subsystem seems to monitor the thumbnail thread first. I'm afraid there's little you can do to change that, just keep this in mind. |
|||
Posted: February 24, 2011 4:49 am | ||||
Sphinx.
![]() |
Small feature request: It would be a little less confusing if the thumbnail rendering thread ignores error and print messages (I'm not sure if it is possible though).
|
|||
Posted: February 24, 2011 5:20 am | ||||
rjp74 |
Thanks Sphinx for your help.
Knowing that there is a pre-pass where the values are set to the thumbnail size rather than the actual image size helps a lot. It means that error() was not appropriate in my case as it applied to the pre-pass not the final pass. Also your idea of using the image to store results was something I had not considered and was helpful in finding out some details which would have been almost impossible using the error() function. The end result of all this was that I completely rewrote my lua script and it is all the better for it! ![]() It was the need to get these dot matrices to have the right aspect ratio irrespective of the original image size which caused me so many problems with the OUTPUT_WIDTH and OUTPUT_HEIGHT values. |
|||
Posted: February 24, 2011 6:30 am | ||||
rjp74 |
The "Hello World" was not accepted as it caused a crash in the library renderer even though the submission checks were ok. I have replaced it with something better which incorporates the small and the large fonts, corrects for the math.floor() issue and uses the OUTPUT_WIDTH and OUTPUT_HEIGHT values successfully. My intention is that you use the lua code in your own filters if you need a text module.
The link to this filter is here: Add Text to Image |
|||
Posted: February 25, 2011 11:52 am |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,712 Registered Users
+19 new in 30 days!
153,534 Posts
+31 new in 30 days!
15,348 Topics
+72 new in year!
33 unregistered users.