changing opacity/transparency of an image

1,058 views
Skip to first unread message

Erin

unread,
Aug 6, 2012, 6:12:45 PM8/6/12
to e-p...@googlegroups.com
I am trying to build an experiment where I incrementally "black out" an image displayed on a black background.  I want to be able to set the image opacity from 0% to 100% in 2% increments.  I will keep the image opacity level constant within a session, but want to be able to change it easily between sessions.  I know I could achieve this in Photoshop by putting a black background behind my image, adjusting the image's opacity, and re-saving the image.  However, I want to be able to draw randomly from a very large bank of images for each stage of the experiment, and it would be prohibitively impractical to adjust all the images manually in Photoshop for each opacity level.

I found a post in this forum on how to fade between two different colors (How to fade from slide1 to slide2 (inline?)), however I haven't been able to find any information on adjusting  opacity/transparency.  Any help would be very appreciated.  Thank you!


Erin

Larsen, Jeff

unread,
Aug 7, 2012, 6:07:46 AM8/7/12
to <e-prime@googlegroups.com>
I don't have access to my computer for a couple weeks, but we did something similar a few years ago. Basically we made a canvas that contained the picture but randomly replaced x% of the picture's pixels with black dots with the setpixel function.

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com<mailto:e-p...@googlegroups.com>.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com<mailto:e-prime+u...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/RbqV-jsq3MsJ.
For more options, visit https://groups.google.com/groups/opt_out.


David McFarlane

unread,
Aug 7, 2012, 11:16:42 AM8/7/12
to e-p...@googlegroups.com
Erin,

See also http://en.wikipedia.org/wiki/Alpha_compositing for
theoretical background, from which you could derive specific
programming steps for E-Prime or any other suitable programming platform.

-----
David McFarlane

Paul Groot

unread,
Aug 7, 2012, 6:06:00 PM8/7/12
to e-p...@googlegroups.com
Erin,
 
Since EPrime doesn't have a builtin transparency option, this would be something you will have to implement yourself. The most straightforward way would be to manipulate an offscreen bitmap using the GetPixel/SetPixel functions. However, using EBasic this way would take ages. Another option would be to have an external DLL-function to do all the work (using optimized C++ code for example), but unfortunately this requires serious programming skills.
 
best,
paul

2012/8/7 Erin <erin.s...@gmail.com>
I am trying to build an experiment where I incrementally "black out" an image displayed on a black background.  I want to be able to set the image opacity from 0% to 100% in 2% increments.  I will keep the image opacity level constant within a session, but want to be able to change it easily between sessions.  I know I could achieve this in Photoshop by putting a black background behind my image, adjusting the image's opacity, and re-saving the image.  However, I want to be able to draw randomly from a very large bank of images for each stage of the experiment, and it would be prohibitively impractical to adjust all the images manually in Photoshop for each opacity level.

I found a post in this forum on how to fade between two different colors (How to fade from slide1 to slide2 (inline?)), however I haven't been able to find any information on adjusting  opacity/transparency.  Any help would be very appreciated.  Thank you!


Erin

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages