Examples of Image


Examples of com.google.api.adwords.v200909.cm.Image

        }

        numAds = generator.nextInt(10) + 1;
        for (int k = 0; k < numAds; k++) {
          ImageAd ad = new ImageAd();
          Image image = new Image();
          image.setData(DataUtils.getTestImage());
          image.setName("name.jpg");
          ad.setImage(image);
          ad.setDisplayUrl("http://google.com/");
          ad.setUrl("http://example.com");
          ad.setName("name.jpg");
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.Image

      // Get the MediaService.
      MediaServiceInterface mediaService =
          user.getService(AdWordsService.V201306.MEDIA_SERVICE);

      // Create image.
      Image image = new Image();
      image.setData(ImageUtils.getImageDataFromUrl("http://goo.gl/HJM3L"));
      image.setType(MediaMediaType.IMAGE);

      Media[] media = new Media[] {image};

      // Upload image.
      Media[] result = mediaService.upload(media);

      // Display images.
      if (result != null) {
        image = (Image) result[0];
        Map<MediaSize, Dimensions> dimensions = MapUtils.toMap(image.getDimensions());
        System.out.println("Image with id '" + image.getMediaId()
            + "', dimensions '" +  dimensions.get(MediaSize.FULL).getWidth() + "x"
            + dimensions.get(MediaSize.FULL).getHeight() + "', and MIME type '"
            + image.getMediaType() + "' was uploaded.");
      } else {
        System.out.println("No images were uploaded.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of com.google.api.adwords.v201309.cm.Image

      // Get the MediaService.
      MediaServiceInterface mediaService =
          user.getService(AdWordsService.V201309.MEDIA_SERVICE);

      // Create image.
      Image image = new Image();
      image.setData(ImageUtils.getImageDataFromUrl("http://goo.gl/HJM3L"));
      image.setType(MediaMediaType.IMAGE);

      Media[] media = new Media[] {image};

      // Upload image.
      Media[] result = mediaService.upload(media);

      // Display images.
      if (result != null) {
        image = (Image) result[0];
        Map<MediaSize, Dimensions> dimensions = MapUtils.toMap(image.getDimensions());
        System.out.println("Image with id '" + image.getMediaId()
            + "', dimensions '" +  dimensions.get(MediaSize.FULL).getWidth() + "x"
            + dimensions.get(MediaSize.FULL).getHeight() + "', and MIME type '"
            + image.getMediaType() + "' was uploaded.");
      } else {
        System.out.println("No images were uploaded.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of com.google.api.services.compute.model.Image

  public Instance createInstance(GoogleCloud cloud, MachineCreationRequest request, PublicKey sshPublicKey)
      throws OpsException {
    // GoogleComputeClient computeClient = getComputeClient(cloud);

    try {
      Image foundImage = null;

      {
        DiskImageRecipe recipe = null;
        if (request.recipeId != null) {
          recipe = platformLayerClient.getItem(request.recipeId, DiskImageRecipe.class);
        }

        OperatingSystemRecipe operatingSystem = null;
        if (recipe != null) {
          operatingSystem = recipe.getOperatingSystem();
        }

        log.info("Listing images to pick best image");
        Iterable<Image> images = listImages(PROJECTID_GOOGLE);

        // TODO: We need a better solution here!!
        log.warn("Hard coding image names");
        Set<String> imageNames = Sets.newHashSet("ubuntu-12-04-v20120621");
        // Set<String> imageNames = Sets.newHashSet("centos-6-2-v20120621");

        for (Image image : images) {
          if (imageNames.contains(image.getName())) {
            foundImage = image;
            break;
          }
        }

        if (foundImage == null) {
          throw new IllegalArgumentException("Could not find image");
        }
      }

      // GCE requires that the name comply with RFC1035, which I think means a valid DNS
      // For now, just use a UUID, with a pl- prefix so it doesn't start with a number
      // TODO: Fix this!
      String instanceName = "pl-" + UUID.randomUUID().toString();

      Operation createServerOperation;
      {
        Instance create = new Instance();

        create.setName(instanceName);

        create.setZone(buildZoneUrl(projectId, ZONE_US_CENTRAL1_A));

        {
          NetworkInterface networkInterface = new NetworkInterface();
          networkInterface.setNetwork(buildNetworkUrl(projectId, "default"));

          AccessConfig networkAccessConfig = new AccessConfig();
          networkAccessConfig.setType("ONE_TO_ONE_NAT");

          networkInterface.setAccessConfigs(Lists.newArrayList(networkAccessConfig));

          create.setNetworkInterfaces(Lists.newArrayList(networkInterface));
        }

        Metadata metadata = new Metadata();
        metadata.setItems(Lists.<Items> newArrayList());
        create.setMetadata(metadata);

        if (request.tags != null) {
          for (Tag tag : request.tags) {
            Metadata.Items meta = new Metadata.Items();
            meta.setKey(tag.getKey());
            meta.setValue(tag.getValue());
            metadata.getItems().add(meta);
          }
        }

        if (request.sshPublicKey != null) {
          Metadata.Items meta = new Metadata.Items();
          meta.setKey("sshKeys");
          meta.setValue(USER_NAME + ":" + OpenSshUtils.serialize(sshPublicKey));

          metadata.getItems().add(meta);
        }

        create.setImage(foundImage.getSelfLink());

        MachineType flavor = getClosestInstanceType(request);
        if (flavor == null) {
          throw new OpsException("Cannot determine machine type for request");
        }
View Full Code Here

Examples of com.google.appengine.api.images.Image

            if (amount < 0 || amount > 1000 * 1000) {
                resp.sendRedirect("../images/overflow.png");
                return;
            }
            Image canvas = getTickerImage(query.to, amount);

            resp.setContentType("image/png");
            resp.getOutputStream().write(canvas.getImageData());

        } catch (Exception e) {
            resp.sendRedirect("../images/no-data.png");
        }
    }
View Full Code Here

Examples of com.google.code.appengine.awt.Image

    public void drawRenderedImage(RenderedImage rimg, AffineTransform xform) {
        if (rimg == null) {
            return;
        }

        Image img = null;

        if (rimg instanceof Image) {
            img = (Image)rimg;
        } else {
            //TODO: Create new class to provide Image interface for RenderedImage or rewrite this method
View Full Code Here

Examples of com.google.gwt.user.client.ui.Image

        return box;
    }

    private Widget choice() {
        Image clickme = new Image( images.edit() );
        clickme.addClickHandler( new ClickHandler() {

            public void onClick(ClickEvent event) {
                showTypeChoice( (Widget) event.getSource() );
            }
        } );
View Full Code Here

Examples of com.google.wave.api.Image

    if (FormElement.getFormElementTypes().contains(type)) {
      result = new FormElement(type, properties);
    } else if (type == ElementType.GADGET) {
      result = new Gadget(properties);
    } else if (type == ElementType.IMAGE) {
      result = new Image(properties);
    } else if (type == ElementType.ATTACHMENT) {
      byte[] data = null;
      String encodedData = properties.get(Attachment.DATA);
      if (encodedData != null) {
        try {
View Full Code Here

Examples of com.itextpdf.text.Image

    return l1;
   
 
  }
  private static Image getImageFromResource(String URI){
    Image image = null;
    try{
    image = Image.getInstance(URI);
    }catch(IOException ioe){
    //de.printStackTrace();
    }catch(Exception e){
View Full Code Here

Examples of com.jagpdf.Image

        String res_dir = testlib.getResourcesDir();
        String image_path = res_dir + "/images/lena.jpg";
        //
        // image format autodetection
        //
        Image img = doc.image_load_file(image_path);
        canvas.image(img, 50, 50);
        //
        // image format specification (tests enums as well)
        //
        Image img_enum = doc.image_load_file(image_path,
                                             ImageFormat.IMAGE_FORMAT_JPEG);
        canvas.image(img_enum, 310, 50);
        //
        // custom image
        //
        int img_dim = 7;
        byte[] checker_bytes = new byte[img_dim * img_dim];
        for(int i = 0; i < img_dim * img_dim; ++i)
        {
            if (i % 2 == 0)
                checker_bytes[i] = 0;
            else
                checker_bytes[i] = (byte)255;
        }
        ImageDef imgdef = doc.image_definition();
        imgdef.data(checker_bytes, img_dim * img_dim);
        imgdef.dimensions(img_dim, img_dim);
        imgdef.color_space(ColorSpaceType.CS_DEVICE_GRAY);
        imgdef.bits_per_component(8);
        imgdef.dpi(9, 9);
        imgdef.format(ImageFormat.IMAGE_FORMAT_NATIVE);
        Image img_custom = doc.image_load(imgdef);
        canvas.image(img_custom, 50, 310);
        //
        // bad format specification (tests exceptions as well)
        //
        try
        {
            Image img_err = doc.image_load_file(image_path,
                                                ImageFormat.IMAGE_FORMAT_PNG);
            throw new RuntimeException("JagPDFException expected.");
        }
        catch(JagPDFException exc)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.