Problems when jpeg encoding multiple images

Hi, im trying to write a servlet which generates multiple thumbs. However when encoding for the second time i get an error java.io.IOException: reading encoded JPEG Stream.
I can't figure out the problem
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
public class Thumbs extends HttpServlet {
  private String dbDriver = "com.mysql.jdbc.Driver";
  private String dbURL = "jdbc:mysql://localhost/shopper?";
  private String userID = "javauser";
  private String passwd = "javadude";
  private Connection dbConnection;
  //Initialize global variables
  public void init() throws ServletException {
  //Process the HTTP Get request
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try{
      String foreignNr = request.getParameterValues("p")[0];
      String maxDim = request.getParameterValues("s")[0];
      if (foreignNr != null){
        int foreignID = Integer.parseInt(foreignNr);
        int maxDimension = Integer.parseInt(maxDim);
        response.setContentType("image/jpeg");
        OutputStream out = response.getOutputStream();
        writeThumbnailPictures(out,foreignID,maxDimension);
    } catch (Exception ex){
        log(ex.getMessage());
  public void writeThumbnailPictures(OutputStream out,int foreignID,int maxDimension){
    try{
      Class.forName(dbDriver);
      dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
      PreparedStatement pageStatement;
      pageStatement = dbConnection.prepareStatement(
          "select * from pictures where ForeignID = ?");
      pageStatement.setInt(1, foreignID);
      ResultSet recs = pageStatement.executeQuery();
      while (recs.next()) {
        byte[] data = recs.getBytes("Picture");
        if (data != null) {
          Image inImage = new ImageIcon(data).getImage();
          // Determine the scale.
           double scale = (double)maxDimension / (double)inImage.getHeight(null);
           if (inImage.getWidth(null) > inImage.getHeight(null)) {
               scale = (double)maxDimension /(double)inImage.getWidth(null);
           // Determine size of new image.
           // One of them should equal maxDim.
           int scaledW = (int)(scale*inImage.getWidth(null));
           int scaledH = (int)(scale*inImage.getHeight(null));
           // Create an image buffer in
           //which to paint on.
           BufferedImage outImage = new BufferedImage(scaledW, scaledH,
               BufferedImage.TYPE_INT_RGB);
           // Set the scale.
           AffineTransform tx = new AffineTransform();
           // If the image is smaller than
           // the desired image size,
           // don't bother scaling.
           if (scale < 1.0d) {
               tx.scale(scale, scale);
           // Paint image.
           Graphics2D g2d = outImage.createGraphics();
           g2d.drawImage(inImage, tx, null);
           g2d.dispose();
           // JPEG-encode the image
           JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
           encoder.encode(outImage);
      out.close();
    catch(Exception ex){
      ex.printStackTrace();
  //Clean up resources
  public void destroy() {
}

Hi,
I am facing same problem while generating the thumbs. Did you figure out what the problem is? if you have the solution, do post it.
Thanks in advance
Mo

Similar Messages

  • Transparency problems when I distort Pdf image size (ie: 100%x99%) then Export. Is there away to fix

    I sometimes have transparency problems when I distort PDF image size (i.e.: 100%x99%) then Export. Is there away to fix.   Or at least be able to preflight and know I have an issue.

    Mostly I have seen borders and drop shadows that will just go away or other wise not print right but only when I distort the image and only on very complicated large PDF images.  When I print it at same % both horz and vert. this problem goes away.

  • Problems with JPEG encoding

    I'm making photo album on the web. But I have a problem with thumbnails generation. I have read alot about it on this forum (thanks guys) but I have a problem:
    Sometimes (but not every time) and independent on the image I've got thumbnail picture that can not be readed neither by IE or Photoshop or another programm. I'm using next encoding sequence:
    PEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    com.sun.image.codec.jpeg.JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bufferedImage);
    writeParam.setCompressionMode(JPEGImageWriteParam.MODE_EXPLICIT);
    param.setQuality(0.7f, true);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(bufferedImage);
    And this code operate in the Servlet enviroment. So, I can not understand what is wrong?
    Renat.

    Hi Renat.
    I may be wrong but I have observed some troubles with JPEG encoding (particularly because of a lack of CPU)... You may have the same trouble... The problem is that I don't how to catch these errors but if someone knows how to, I would be really interested in... I can only catch them when I decode these images thanks to TruncatedFileException and ImageFormatException.
    Stephane.

  • Problem when setting encoding to ISO-8859-1

    Hi. Is there something I'm missing when it comes to setting
    encoding? Here are the code in the mxml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    </Application>
    In the html-template I'm setting:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1" />
    The code for sending data from the app:
    <mx:HTTPService
    id="service"
    url="encoding.jsp"
    method="post"
    showBusyCursor="true"
    result="onResult(event)"
    resultFormat="xml"
    contentType="application/xml"
    fault="onFault(event)"
    useProxy="false" />
    public function send():void {
    var xml:XML = <Data>{data.text}</Data>;
    service.send(xml);
    But still the respons jsp I have made says it receives the
    data in UTF-8 format? What am I doing wrong?
    Servercode:
    don't work: BufferedReader reader = new BufferedReader( new
    InputStreamReader( is ) );
    work: BufferedReader reader = new BufferedReader( new
    InputStreamReader( is, "UTF-8") );

    Are there no-one who have the same problem? I've tried
    everything imaginable, and still the serverside receives the data
    as UTF-8.
    Is it supported at all to set the encoding of the
    request?

  • Weird Problem when importing Raw .CR2 Image sequences.

    I am trying to import some CR2's image sequences into my AE CS5.5.
    System specs:
    OSX 10.7.4
    Mid 2010 Mac Pro
    2 x 2.66ghz 6-Core Intel Xeon
    ATI Radeon HD 5770 1024MB
    6gb Ram.
    The images are 5616x3744. I also brought in a couple image sequences at 2784x1856, these were brought in fine. But the bigger (let's call them 5k files, even though they aren't technically 5k) images are almost being auto scaled down. See screenshot below.
    This is what they look like when previewing from source clip, its as if they have been scaled down by 1/4. The info on the clip still reports that they are the full 5k resolution. Why could this be happening?

    Could be an embedded preview JPEG/ TIFF instead of the actual RAW data. Verify the files in Photoshop or another program and suppress the preview image on import.
    Mylenium

  • Problem when working with multiple sequences

    Dears,
    In order to make life easier (I am currently working on a rather long project), I work with multiple sequences, one per chapter.
    My problem: I named one sequence "assembly sequences" in order to add the various sequences. I dropped the sequence no 1, then no 2. All works fine, beside that when playing the sequence no 2, I see two black lines on top and bottom of the screen for the all length of the sequence. Which is not the case when I click on the sequence itself and play it independently.
    Any idea how to solve this ?
    Thanks
    Nic

    Thanks, what happened is that :
    1st sequence is like this : Frame size 720x576 pixels, video rate 25fps, Compressor DV-Pal. And I think it is the one appropriate for me and my country.
    2nd sequence is like this : Frame size 720x480 pixels,
    video rate 29.97 fps, Compressor DV-DVPRO-NTSC.
    I think I should change the second sequence setting, but can I do it after all the work I have done, and continue making a 3rd, 4th and so on ?
    Tx for your precious help,
    Nicolas

  • CSS problems in CS4 with multiple images on a page...

    I seem to have a ton of questions going in this forum, sorry if it's painful.
    Here's my latest issue.(DW CS4)
    I created a blank html page and linked a CSS file to it. I dropped a bunch of images into the body and wrapped them in a div with an id of "thumbnails"
    I clicked on my img tag right below the Design window and clicked the "new css rule" button in the CSS Styles window and gave my images a margin of 40 px.  I clicked "OK" and my changes took effect in the Design window, but when I previewed it in the browser (Firefox and IE) none of the CSS was taking effect, all the images were still crammed together. Same thing for the "Live View" Button, I'm not sure what happened, or why the CSS won't take effect.
    Can somebody help me?
    Thanks all,
    Aza

    My HTML follows-----
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="../CssFiles/oneColLiqCtrHdr.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div class="oneColLiqCtrHdr" id="Thumbnails"><img src="../images/Jewelry/Thumbnails/T_Bracelets/Bellarri_ColoredStone_Over10k_1.jpg" width="166" height="150" alt="Bellari" /><img src="../images/Jewelry/Thumbnails/T_Bracelets/CynthiaGregg_Gold_Over5k_1.jpg" width="178" height="150" alt="Cynthia Gregg" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/FrankRuebel_BestBracelet_2501_5k_1.jpg" width="150" height="150" alt="Frank Ruebel" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/Gabriel_BestBracelet_2501_5k_1.jpg" width="156" height="150" alt="Gabriel" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/GeralynSheridan_FashionBridge_500Under_1.jp g" width="178" height="150" alt="Geralyn Sheridan" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/Jyes_Legends_Over5k_1.jpg" width="150" height="150" alt="Jyes Legends" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/Maevona_BestBracelet_5001_10k_1.jpg" width="166" height="150" alt="Maevona" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/SalPraschnik_Legends_Over5k_1.jpg" width="208" height="150" alt="Sal Praschnik" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/Sara_BestBracelet_Over10k_1.jpg" width="156" height="150" alt="Sara" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/Starhaven_Silver_501_1k_1.jpg" width="166" height="150" alt="Starhaven" />
      <img src="../images/Jewelry/Thumbnails/T_Bracelets/SylvaCie_BestBracelet_Over10k_1.jpg" width="150" height="150" alt="Sylva Cie" /></div>
    </body>
    </html>
    *************CSS FOLLOWS********************
    @charset "utf-8";
    body {
        background: #666666;
        margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
        padding: 0;
        text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
        color: #000000;
        background-color: #000000;
    #jewelryFrame {
        font-family: Georgia, "Times New Roman", Times, serif;
        color: #CCC;
    #jewelryFrame p {
        font-size: 12px;
        padding-bottom: 75px;
    .oneColLiqCtrHdr #container {
        width: 100%;  /* this will create a container 80% of the browser width */
        background: #FFFFFF;
        margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
        border: 1px solid #000000;
        text-align: center; /* this overrides the text-align: center on the body element. */
        background-color: #000000;
        max-width: 960px;
        min-width: 800px;
    .oneColLiqCtrHdr #header {
        background: #DDDDDD;
        padding: 0;
        width: 960px;
        height: 141px;
        background-color: #000000;
        color: #CCA4A5;
        font-size: 11px;
        font-style: normal;
        font-family: Goudy Old Style;
        background-image: url(../images/CPJ-Header.png);
    .oneColLiqCtrHdr #header h1 {
        margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
        padding: 30px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
        color: #FFFFFF;
    #navbar {
        background: #999999;
        height: 29px;
        width: 960px;
        background-color: #000000;
        background-image: url(../images/CPJ-NavLT.png);
        background-repeat: repeat;
    .oneColLiqCtrHdr #container #navbar img {
        border-width: 0px;
        border-style: 0;
        border: 0;
    #sideBarLeft {
        float: left;
        width: 30%;
        height: 100%;
        min-width: 250px;
        padding-top: 50px;
        padding-left: 40px;
        padding-right: 40px;
    .oneColLiqCtrHdr #container #sideBarLeft p {
        text-align: justify;
        font-size: 12px;
    .oneColLiqCtrHdr #container #sideBarLeft h2 {
        font-size: 14px;
    .oneColLiqCtrHdr #container #sideBarLeft h1 {
        font-size: 24px;
    .oneColLiqCtrHdr #container #sideBarLeft {
        color: #CCC;
        padding-top: 15%;
        padding-bottom: 15%;
    .oneColLiqCtrHdr #mainContent {
        padding: 0 60px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
        background: #FFFFFF;
        background-color: #000000;
        color: #969696;
        font-family: "Goudy Old Style";
        font-size: 18px
        text-align: center;
        vertical-align: middle;
        min-height: 500px;
    .oneColLiqCtrHdr #container #mainContent p {
        font-family: "Goudy Old Style";
        font-size: 18px;
    .oneColLiqCtrHdr #container #mainContent h1   {
        padding: 0px;
        font-family: Georgia, "Times New Roman", Times, serif;
        color: #969696;
        font-family:"Goudy Old Style";
        font-size:36px;
    .oneColLiqCtrHdr #container #mainContent h6 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 72px;
        font-weight: bold;
        vertical-align: middle;
        line-height: normal;
        color: #CCC;
    .oneColLiqCtrHdr #container #mainContent #staticprivacy h3 {
        padding: 0px;
    #jewelryFull {
        padding-top: 25px;
        padding-right: 0px;
        padding-bottom: 25px;
        padding-left: 0px;
        font-family: Georgia, "Times New Roman", Times, serif;
        float: none;
        width: 100%;
        max-width: 960px;
        background-image: url(../images/CPJ--MainBG_slice_15.png);
    .oneColLiqCtrHdr #container #mainContent #jewelryFull {
        font-family: Arial, Helvetica, sans-serif;
        color: #CCC;
    .oneColLiqCtrHdr #container #mainContent #jewelryFull img {
        border-top-style: solid;
        border-right-style: solid;
        border-bottom-style: solid;
        border-left-style: solid;
        border-top-color: #CCC;
        border-right-color: #666;
        border-bottom-color: #666;
        border-top-width: medium;
        border-right-width: medium;
        border-bottom-width: medium;
        border-left-width: medium;
        margin-top: 25px;
    .oneColLiqCtrHdr #container #mainContent #jewelryFull p {
        text-align: justify;
        margin-top: 0px;
        font-size: 10px;
    .oneColLiqCtrHdr #container #mainContent #mycarousel {
        text-align: center;
        height: 500px;
    .oneColLiqCtrHdr #footer {
        padding: 0; /* this padding matches the left alignment of the elements in the divs that appear above it. */
        background:#DDDDDD;
        background-image: url(../images/CPJ-Red-Footer.png);
        height: 63px;
        width: 960px;
        vertical-align: top;
        list-style-type: none;
        clear: both;
    #BottomNav {
        font-family: "Arial Black", Gadget, sans-serif;
        font-size: 11px;
        color: #CCC;
        height: 100%;
        margin: 0;
    .oneColLiqCtrHdr #container #footer #BottomNav ul {
        list-style-type: none;
    .oneColLiqCtrHdr #container #footer #BottomNav ul li {
        display: inline;
    .oneColLiqCtrHdr #container #footer #BottomNav ul li a {
        list-style-type: none;
        list-style-image: none;
        float: right;
        padding-right: 45px;
        color: #969696;
        text-decoration: none;
        font-weight: 500;
        font-family: Arial, Helvetica, sans-serif;
        padding-top: 10px;
    .oneColLiqCtrHdr #footer p {
        margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
        padding: 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
        color: #FFF;
        text-align: right;
        font-family: Tahoma, Geneva, sans-serif;
        font-size: 12px;
    #quotes {
        text-align: center;
        margin-right: 65px;
        float: none;
    #quoteright {
        text-align: right;
        margin-right: 65px;
    #quotesleft {
        text-align: left;
        text-indent: 65px;
    #companyTitle {
        font-family: "Lucida Console", Monaco, monospace;
        font-size: 24px;
    #medImageArea {
        width: 100%;
        height: 50px;
    #Thumbnails img {
        padding: 40px;
    ************Thank you****************

  • Connection problems when I use multiple Airport Expresses

    I have one Mac that I use to stream music to multiple Airport Express's. Its seems that when I connect to 3 expresses things work fine. If I connect to 4 the sound cuts out on all speakers.
    Is 3 the limit or am I doing something wrong?

    Yes you can but....
    With the apex in the ceiling you may get a signal loss from your main wireless system. To be able to do what you want in a whole home sound system they all need to be on the main wireless system. You also have to plug them in to a wall outlet which may be an issue with your fire regulations with them inside the walls/ceiling. With airplay you have some limitation also. If she has an ios device and likes say pandora she can only do it to one set of speakers/APex. Only itunes from a computer can do multiple/house party sound. I have 2 APex in my house and love them all. If your main wifi is out of range for some of the new APex's you can run 1 cat5/6 (APex is 10/100)  and make a new network and bridge the rest to it. As long as your new wire is connected to your main network you will stay on the same network.
    So now you get sound and a roaming wifi through out the house. (that's what I did but not in the ceiling.)
    Sonus are good but $$$. by then rewire!

  • When I open multiple images, they open one on top of the other, filling the entire workspace

    I'd like to be able to view them and edit them side by side, but when I click on one, it opens on top of the other. I don't know how to change this so the images can be edited side-by-side. I tried Cascade, but it's grayed out and not an option. Help!

      It’s best to change preferences and then cascade and the other options become available.
    Click Edit à Preferences à General
    Then check Allow Floating Documents in full Edit.
     

  • Motion Travel Template problem when exporting to FCP - image looks jittery

    The still-frame pics I put in the Travel Template of Motion look distorted, "jittery", when the image scrolls across the screen during playback on the timeline sequence in Final Cut Pro. I exported the file from Motion as a Quicktime movie and imported the file into Final Cut. How do I reduce the "jitters" ?
    Thanks!
    Jeff

    http://daystreet.com/Motiontext/Motiontext.html

  • PLEASE HELP!!! I'm going nuts! Javascript problem when trying to load images on E-Bay auctions and My Space doesn't look right

    This is the second time I've been here for help and I have had to use IE for the past few weeks because I still have this problem. The images on E-Bay's individual auctions begin to load then stop, I believe it is a Javascript problem. I've already tried the troubleshooting tips for "images don't display" AND I have uninstalled/reinstalled Firefox to no avail. My Space doesn't seem to be displaying properly either, for example, if I want to change the color of a font in a message the boxes appear, but no color...please SOMEBODY HELP! Thank you!
    == URL of affected sites ==
    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230497781181&ssPageName=ADME:B:SS:US:1123

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    You can also try "Reset all user preferences to Firefox defaults" on the [[Safe mode]] start window - See http://kb.mozillazine.org/Resetting_preferences

  • Can a pdf have problems when created with multiple PDF versions?

    In our everyday workflow, we have PDFs created from different versions.  Our main files are created as PDF v1.5, but then we might import pages created from another software that is v1.3, then we might scan and add a page that is created as v1.6.  Has anyone noticed any issues with files created this way?  I am troubleshooting some problem files and wonder if this could be contributing.
    Thanks.

    Could possibly be an issue, but it likely depends on the features used. The major problem would be going from later versions to prior versions in terms of the version you open everything in. If you are using the latest version for the editing, I would not see why there would be a problem. Earlier versions of Acrobat may have problems with PDFs saved in later versions, but that can typically be fixed with Reduce File Size or the PDF Optimizer.

  • Issues when selecting multiple images in LR6.

    I've noticed a few changes to how LR6 behaves when I select multiple images.
    First, if I select a few images in the Library view, I am only essentially "stuck" in those images when I press the left or right arrow keys. In previous versions of LR, hitting the left or right arrow would move to image on either side of the selected images. Now I'm only able to endlessly scroll through the selected images and I have to press the up or down arrow to get out of the selected images. Is there a way to change it back to how it used to work?
    Second, and I think this is related to the first issue, I used to be able to select all images in a collection, press the down arrow and I'd end up at the last image in a collection. Now, it no longer works.
    Anyone else notice either of these things? Have you found a way to change it back to how it's always been?
    Thanks!

    Interesting. I just went back to LR5.7 (Mac) and confirmed that it behaves just like I originally said, but LR6 does not. Maybe Windows has always been this way? Regardless, any input from Mac users?

  • Aperture cannot add GPS data to multiple images at the same time

    I am new to Aperture and have been using it for a week or so now. Today I tried to add GPS data to a number of images and found out, it appears Aperture can only add GPS data to one image at the time. When I select multiple images to add the GPS data to, it just doesn't do anything. It leaves the GPS data blank.
    Here is what I do:
    From the Info-tab I select "GPS" from the drop down menu
    At the bottom of the info tab I show the map
    In the map's search box I enter the location I want to assign to the photo(s)
    From the resulting drop down menu I select the locatiion I want and press the "assign to location" button
    As long as I choose only a single image, this works fine and the GPS Data is added. Not so when I select more than a single image. After pressing the "assign to location" button it seems as if the GPS data is added (there is no message indicating otherwise), but the GPS data in the selected images is blank.
    What am I doing wrong ?
    Additional info
    I have been testing this a bit more and the behavior is even more strange: When you select multiple images in Aperture, they get a thin white border, except the one that you touch last (normally the last image of the selection) that will have a thicker border around it. It appears that, when selecting multiple images, the GPS data is ONLY assigned to the photo in the selected setthat has the thicker border (?????)
    Message was edited by: dinky2

    Rereading your post, I think the problem is, that you are assigning the location from the Info panel and not from the Metadata menu. The Info panel and the Metadata menu ar behaving differently.
    The Info panel will always only affect the primary selection, but the Metadata menu will work on all selected images (unless "Primary only" is checked). So , if you want to assign your location to multiple images, use "Metadata > Assign location" instead of the little map in the "Info" panel.
    Or use the "Places" view. Then you can drag all images at once to the same pin on the map.
    Regards
    Léonie

  • Lost ability to select/edit multiple images

    my apologies if this is a simple question. I must have somehow disabled the feature that allowed me to select multiple images (i.e. images 1-10 within a particular project/folder) and edit them all at once. when i select multiple images and attempt to edit/stamp/rotate all at once, only the last selected image (i.e. #10) is changed. is there a feature i somehow disabled that is causing this? i never had problems with this feature prior to a few weeks ago.

    primary only was selected ...
    keyboard shortcut is 'S' ... also under Edit -> Primary Only ...
    third place is on the bottom control bar ...

Maybe you are looking for