Welcome!

Adobe Flex Authors: Matthew Lobas, PR.com Newswire, Shelly Palmer, Kevin Benedict

Related Topics: Adobe Flex

Adobe Flex: Article

Optimizing Your JPEG Slices in Fireworks

Optimizing Your JPEG Slices in Fireworks

When you want to make an image available on the Web, there are two important constraints. It needs to look its best and it must download fast. Those two rarely, if ever, go together. Better image quality means a larger file size, which translates to longer download times. Broadband connections help reduce download times but not eveyone is sitting behind a fat pipe that is sucking up the internet.

This month I'll discuss the JPEG format (pronounced "jay-peg"). When I sat down to write this article, a voice in my head kept screaming "this is so "97", and in a way I must admit it is. Then again, why is it that so many folks today still choose wrong image formats? Or don't know how to use selective JPEG compression in Fireworks? Um, selective what? Where? I seriously hope you didn't ask the last question.

The Basics
JPEG is a standardized image compression mechanism designed to compress full-color or grayscale images of natural, real-world scenes. The JPEG file structure splits the data into two parts - monochrome and color information - and applies different compressions to each of them. The monochrome portion defines the objects in a picture — it provides detail and brightness. The human eye is more sensitive to small brightness variations than it is to color variations. So discarding color information is less noticeable to the human eye than discarding monochrome information. JPEG exploits this fact. It compresses color information more than its monochromatic counterpart, and as a result it produces smaller file sizes without sacrificing their viewing quality —at least the way the human eye understands it. For the same reason, JPEG does a poor job when blocks of solid color are present, resulting in visible artifacts.

JPEG is "lossy," meaning when you use it to compress an image, information is lost permanently. The resulting image is not the same as the image you start with. If you keep editing that JPEG and export it back as a JPEG as you make edits to it, image degradation will be obvious before too long.

The Joint Photographic Experts Group was the committee that wrote the standard, and this is how this acronym came about.

Compression Levels
You control the data you lose as you compress an image by altering its compression level. Higher compression levels result in smaller images with less image quality. You can trade off file size for image quality.

The compression levels are not standard in all the imaging applications that use JPEG. Some use a rating of 1-10, others 0-100. Some use this rating to refer to image quality while others use it to refer to compression level. Fireworks uses a rating for image quality between 0 and 100. Zero means minimum quality (maximum compression) and 100 means maximum quality (minimum compression). But don't let the scale trick you. Setting image quality to 80, for example, doesn't mean you will get 80% of the quality of the original image. It simply means that if 100 is the maximum quality then 80 is 20 clicks lower.

A common question is, "how much compression should I use?" There aren't any magic numbers. Experiment by adjusting the values until you get a result that has enough image quality and a satisfactory file size for your application. Fireworks defines two presets: JPEG - Better Quality and JPEG - Smaller Size that you can use as your starting point. Often they may be just right. However, you should experiment and compare results if you want to squeeze the most out of your JPEGs.

Optimize Panel
The Optimize panel (Window > Optimize) gives you access to various settings for each slice. With a JPEG slice selected, your Optimize panel will look similar to the one shown in Image I.

 

As I mentioned earlier, Fireworks uses a 0-100 rating for the JPEG image quality. You can adjust this value using Quality on the panel.

Selective quality is available when a JPEG mask is present. In a nutshell, it allows you to apply two different compression settings. You can, for example, have low compression (high quality) in areas of the image that are important, and high compression (low quality) in areas of lower importance. We will discuss this in detail later.

I've talked about how JPEG compresses the color information of an image more aggressively than its monochrome information. This way we get smaller files and the data lost is not visible as much, if at all. Of course this means that you can compress an image with little detail more and quality loss will not be obvious.

Smoothing specifies a threshold value for blurring the edges of the image. By reducing the details of the image, it becomes more compressible. A value of zero will not make any changes to the edges of the image. A value of eight (maximum value) will reduce details in the image heavily and the resulting JPEG will achieve a higher compression level, resulting in smaller file size.

I try to avoid resorting to smoothing to reduce file size since the images produced are "soft." There are cases, however, when the trade-off is acceptable and smoothing by 1 or 2 does not have a large impact and I can squeeze a couple of Ks out of it. It's all about trial and error.

Another option for a JPEG slice is sharpening the edges. This increases the details of the JPEG by sharpening it, which based on what we already know results in an image that appears to have more detail since our eye is more sensitive to brightness changes. At the same time, since the edges of the image are more pronounced, the image can't be compressed as much and maintain acceptable quality. You can locate this setting under the options menu of the Optimize panel (see Image II).

 

I suggest toggling that option on and off while in Preview so you can see how much it affects the quality of the image and the file size.

Progressive JPEG
Another choice for your JPEG slices in Fireworks is Progressive JPEG. A simple JPEG is stored as one top-to-bottom scan of the file. The decoder (that is, the browser when viewing the image on the Web) performs a single scan of the image and displays it. Progressive JPEG divides the file into a series of scans. The first scan shows the image at a low quality (heavily compressed) that has small file size and can show up quickly. Each scan that follows adds to the quality of the image. A Progressive JPEG is slightly larger in file size compared to a simple JPEG, but loading over a network seems faster.

You can set a JPEG slice as a Progressive JPEG in Fireworks using the options menu of the Optimize panel (see Image II).

Selective JPEG Compression
When you define a JPEG slice some areas may be more important than others. One such example is a portrait photograph where the background is out of focus. In a case like this you want to keep your subject's quality high; the rest, which is not as important, can be compressed more.

Although it is not the best approach to include text in a JPEG (remember our discussion about edges) sometimes you just have to. You can apply low compression around the text and a higher compression to the rest of the image. This way you can keep your text crisp, and achieve a small file size.

The technique of applying different compression levels in different areas of an image is called Selective JPEG Compression. Fireworks makes it easy to use selective compression.

Let's say I have this photo and I must include a label on it. I can compress it a lot and still get acceptable results, but the text looks horrible (see Image III).

 

Selective JPEG compression to the rescue! With the JPEG slice, select Selective JPEG compression and bring up the Optimize panel. The Selective quality field is disabled. Click on the edit button next to it and the Selective JPEG Settings dialog comes up (see Image IV).

 

Check Enable selective quality and Preserve text quality. By doing so, any text block in the selected slice will have different compression levels. In my example I have a JPEG for which I can use quality 40 and selective quality 90. You can see how much difference it makes to the clarity of text in Image III.

Let's look at an example where we can define the area to apply selective quality manually. I'll start with the photo on the left in Image V.

 

In this case I want to keep as much quality as I can on the subject but I don't care about the quality of the foliage in the background. My first step is to create a selection of the area I am interested in. In this case I created a selection of the background (middle photo, Image V) and using Select > Select Invert I got the subject selected. With the selection active, choose Modify > Selective JPEG > Save Selection as JPEG Mask. In the last photo of Image V, the area with the red overlay is the JPEG Mask I've created.

Now I can create a JPEG slice for that photo and set its Quality low while the Selective quality is at a higher value. This way I compress the background more than the subject, dropping data from the less important areas of the photo.

Again, there are no magic numbers. Experiment with the values and find the ones that produce the best results for your test or the file size requirements you may have.

Under Selective JPEG, you'ill find other options that become available after you enable it. Use Restore JPEG Mask as Selection to restore your selection and manipulate it further. Then save this new selection again as the JPEG Mask you want to use. Of course, if you change your mind and want to start fresh, you use Remove JPEG Mask.

More Stories By Kleanthis Economou

Kleanthis Economou has been a Web developer/software engineer since 1995 and specializes in .NET Framework solutions. He is a contributing author of various Fireworks publications and is the technical editor of the Fireworks MX Bible. As an extension developer, Kleanthis contributed two extensions to the latest release of Fireworks.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
DXWorldEXPO LLC, the producer of the world's most influential technology conferences and trade shows has announced the 22nd International CloudEXPO | DXWorldEXPO "Early Bird Registration" is now open. Register for Full Conference "Gold Pass" ▸ Here (Expo Hall ▸ Here)
"We are a well-established player in the application life cycle management market and we also have a very strong version control product," stated Flint Brenton, CEO of CollabNet,, in this SYS-CON.tv interview at 18th Cloud Expo at the Javits Center in New York City, NY.
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
Here are the Top 20 Twitter Influencers of the month as determined by the Kcore algorithm, in a range of current topics of interest from #IoT to #DeepLearning. To run a real-time search of a given term in our website and see the current top influencers, click on the topic name. Among the top 20 IoT influencers, ThingsEXPO ranked #14 and CloudEXPO ranked #17.
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
The Founder of NostaLab and a member of the Google Health Advisory Board, John is a unique combination of strategic thinker, marketer and entrepreneur. His career was built on the "science of advertising" combining strategy, creativity and marketing for industry-leading results. Combined with his ability to communicate complicated scientific concepts in a way that consumers and scientists alike can appreciate, John is a sought-after speaker for conferences on the forefront of healthcare science,...
In his session at Cloud Expo, Alan Winters, U.S. Head of Business Development at MobiDev, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to maximize project result...
In his keynote at 19th Cloud Expo, Sheng Liang, co-founder and CEO of Rancher Labs, discussed the technological advances and new business opportunities created by the rapid adoption of containers. With the success of Amazon Web Services (AWS) and various open source technologies used to build private clouds, cloud computing has become an essential component of IT strategy. However, users continue to face challenges in implementing clouds, as older technologies evolve and newer ones like Docker c...
Personalization has long been the holy grail of marketing. Simply stated, communicate the most relevant offer to the right person and you will increase sales. To achieve this, you must understand the individual. Consequently, digital marketers developed many ways to gather and leverage customer information to deliver targeted experiences. In his session at @ThingsExpo, Lou Casal, Founder and Principal Consultant at Practicala, discussed how the Internet of Things (IoT) has accelerated our abilit...
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at Cloud Expo, Ed Featherston, a director and senior enterprise architect at Collaborative Consulting, discussed the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settl...
IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...