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
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
Product connectivity goes hand and hand these days with increased use of personal data. New IoT devices are becoming more personalized than ever before. In his session at 22nd Cloud Expo | DXWorld Expo, Nicolas Fierro, CEO of MIMIR Blockchain Solutions, will discuss how in order to protect your data and privacy, IoT applications need to embrace Blockchain technology for a new level of product security never before seen - or needed.
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
Digital Transformation (DX) is not a "one-size-fits all" strategy. Each organization needs to develop its own unique, long-term DX plan. It must do so by realizing that we now live in a data-driven age, and that technologies such as Cloud Computing, Big Data, the IoT, Cognitive Computing, and Blockchain are only tools. In her general session at 21st Cloud Expo, Rebecca Wanta explained how the strategy must focus on DX and include a commitment from top management to create great IT jobs, monitor ...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
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...
Recently, WebRTC has a lot of eyes from market. The use cases of WebRTC are expanding - video chat, online education, online health care etc. Not only for human-to-human communication, but also IoT use cases such as machine to human use cases can be seen recently. One of the typical use-case is remote camera monitoring. With WebRTC, people can have interoperability and flexibility for deploying monitoring service. However, the benefit of WebRTC for IoT is not only its convenience and interopera...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
"Digital transformation - what we knew about it in the past has been redefined. Automation is going to play such a huge role in that because the culture, the technology, and the business operations are being shifted now," stated Brian Boeggeman, VP of Alliances & Partnerships at Ayehu, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...