Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Pixel Bender Technology Center /

Effects with the Pixel Bender Toolkit – Part 2: Creating a vintage tone filter

by Kevin Goldsmith

Kevin Goldsmith

Content

  • Setting up the files
  • Modifying the red channel of the image
  • Modifying the blue channel of the image
  • Modifying the green channel of the image
  • Preparing a filter for Flash Player
  • Where to go from here

Created

11 January 2010

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash Professionalgraphic effectsPixel Bender
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

Some familiarity with ActionScript 3.

User level

Beginning

Required products

  • Flash Player 10 and later
  • Flash Professional (Download trial)
  • Pixel Bender Toolkit (Macintosh)
  • Pixel Bender Toolkit (Windows)

Sample files

  • pixel_bender_02.zip (5 KB)

In this article, you will change a Pixel Bender filter to make it modify the colors of the source image to produce a vintage tone effect. After editing and updating the filter, you'll export the new filter for use in Adobe Flash projects. This is the second installment in this series of articles about using the Pixel Bender Toolkit to create visual effects with bitmap images.

In the previous section, you learned how to work within the Pixel Bender IDE to create a new filter, run it, and save it. In this section, you'll learn about creating a more complicated filter by writing code that controls the color values of the loaded image.

Setting up the files

If you've been following along with Part 1 of this article series, open the filter that you created in the previous section. Otherwise, download and uncompress the sample files provided, and open the file named Exercise2FilterA.pbk.

The text displayed in the edit window will look similar to the following code example:

<languageVersion : 1.0;> kernel Part2Filter < namespace : "com.adobe.devnet.pixelbender"; vendor : "Kevin's Filter Factory"; version : 1; description : "Playing around with pixels"; > { input image4 src; output pixel4 dst; void evaluatePixel() { dst = sampleNearest(src,outCoord()); } }

Note: If you entered your own values for the strings in the previous section, your code may differ slightly.

The image in the preview window looks like Figure 1.

Input image displayed in the preview window
Figure 1. Input image displayed in the preview window

Modifying the red channel of the image

In this section, you'll edit the code slightly to affect the red color value in the input image. Follow these steps:

  1. Locate the line shown below:
dst = sampleNearest(src,outCoord());
  1. Immediately after the line shown above, add a new line and type the following code:
dst.r += 0.1;
  1. After making these changes, the evaluatePixel function will look like this:
void evaluatePixel() { dst = sampleNearest(src,outCoord()); dst.r += 0.1; }
  1. Click the Run button to run the filter.

When you preview the image, the red channel is slightly accentuated (see Figure 2).

Red areas in the image accentuated after running the red filter
Figure 2. Red areas in the image accentuated after running the red filter

Choose File > Save Filter to save the filter. Name it Exercise2.pbk and save it in the pixel_bender folder on your desktop.

If you'd like to create a more dramatic effect, try the following:

  1. Change the amount added to the red channel from 0.1 to 0.5.
  2. Click the Run button.
  3. Save the filter.

After trying this experiment, the image displays the pixels with a strong red cast (see Figure 3).

After updating the red channel's color value: lots of red
Figure 3. After updating the red channel's color value: lots of red

Note: The default new kernel takes a four-channel image and creates a four-channel image as a result. The channels are red, green, blue, and alpha (the transparency information). Each channel is represented as a floating-point number between 0.0 and 1.0.

Modifying the blue channel of the image

Follow these steps to change the blue channel in the input image:

  1. Locate the following code; this is the line that modifies the red channel:
dst.r += 0.5;
  1. Immediately after the line above, add the following line of code:
dst.b -= 0.4;
  1. Click the Run button to run the filter.
  2. Save the filter.

The image in the preview window appears with a noticeable reduction in the blue channel. This effect, combined with the accentuation of the red channel, results in a yellowish cast to the image (see Figure 4).

After affecting both the red and blue filters: lots of yellow
Figure 4. After affecting both the red and blue filters: lots of yellow

Modifying the green channel of the image

Follow these steps to update the values of the green channel in the image:

  1. Locate the line in the code that modifies the blue channel:
dst.b -= 0.4;
  1. Immediately after that line of code, add a new line and type in the following code:
dst.g -= 0.1;
  1. Click the Run button to run the filter.
  2. Save the filter.

When you preview the image, the green channel in the image should be slightly reduced. This effect, combined with the modifications to the other color channels, creates a vintage-tone effect on the image (see Figure 5).

After affecting the red, blue, and green filters: a vintage tone
Figure 5. After affecting the red, blue, and green filters: a vintage tone

Preparing a filter for Flash Player

In this section, you'll learn how to set up the filter to play back in Flash Player 10. It is important to note that earlier versions of Flash Player do not support the display of filters created with the Pixel Builder Toolkit. Be sure you have Flash Player 10 (or later) installed on your machine.

Follow these steps:

  1. Choose Build > Turn on Flash Player Warnings and Errors. This option enables filter validation for Flash Player when running filters, to help you perform troubleshooting.
  2. Click the Run button to run the filter.
  3. Verify that the filter runs successfully without generating any errors.
  4. Choose File > Export Kernel Filter for Flash Player.
  5. In the Export dialog box that appears, enter the name for the filter: Exercise2Filter.pbj
  6. Save the PBJ file in the pixel_bender folder on your desktop.

Note: Flash Player 10 supports a subset of the Pixel Bender language. Be sure to read the Pixel Bender Toolkit documentation for more information.

Where to go from here

After familiarizing yourself with the Pixel Bender interface, continue with Part 3 in this series, where you'll learn how to add parameters to filters.

Check out the following resources to learn more about working with the Pixel Bender Toolkit:

  • Pixel Bender forum
  • Pixel Bender basics for Flash
  • Pixel Bender basics for Flex and AIR

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Effects with the Pixel Bender Toolkit – Part 10: Using a multiple-input filter as a blend shader
  • Effects with the Pixel Bender Toolkit – Part 8: Controlling the displacement filter with mouse positioning
  • Effects with the Pixel Bender Toolkit – Part 4: Sampling multiple pixels
  • Pixel Bender release notes
  • Effects with the Pixel Bender Toolkit – Part 3: Adding parameters to filters
  • Effects with the Pixel Bender Toolkit – Part 6: Modifying Pixel Bender parameters in Flash
  • Animating a particle system using Pixel Bender
  • Effects with the Pixel Bender Toolkit – Part 9: Integrating multiple image sources with a Pixel Bender kernel
  • Effects with the Pixel Bender Toolkit – Part 5: Applying a filter to an image in Flash
  • Effects with the Pixel Bender Toolkit – Part 7: Improving the displacement filter

Tutorials & Samples

Tutorials

  • Animating a particle system
  • Using a multiple-input filter in Pixel Bender as a blend shader
  • Controlling the displacement filter in Pixel Bender with mouse positioning

Samples

Pixel Bender Forum

More
05/09/2013 Pixel Bender Installation
02/10/2012 I Cannot get pixel bender to show in PS
05/31/2009 White Hat PBJ Decompiling
01/19/2013 Multiple Image inputs in Blendmode Shader

Pixel Bender Exchange

More
Escher's Droste Effect
4D Quaternion Julia-set Ray Tracer with Ambient Occlusion
Zoom Blur Focus
Raytracer

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement