lundi 20 avril 2015

Core point of binary image

How to find the the center of mass or the core point (x,y) of a binary image using Java?
Lets say I have this Picture "Binary, ones=Green" :

enter image description here

And I want to find the red dot "center of mass" as a Point(x,y).

What are the standard methods for comparing image quality? [on hold]

I am trying to figure out what the standard methods for compare image quality are. I know of SNR, PSNR, RMSE, MAE, and SSIM.

However, I have also read a little bit about trying to model the human visual system because these metrics aren't the best. I've also heard about doing subjective testing, but that is not feasible for me.

Is there some standard set of image metrics are provided when comparing the quality of two images?

Specifically I am trying to reconstruct images collected with a sensor I built and I want to compare the gold standard to images I have with special filtering and image improvement techniques.

Select image and create object. Processing 2.0

here is a code snippet from my Image class:

class Image{

  public int width;
  public int height;

  public PImage img;

  Image(PApplet parent){

    width = 512;
    height = 512;

    img = new PImage();
    img = parent.loadImage("test.jpg");
    img.resize(width, height);
  }
}

I draw it in the main file in such a way:

image(image.img, 287, 280);

I'd like to choose the image having clicked it:

void mousePressed() {
   if (gui.btnOver1) {
     selectInput("Choose file:", "fileSelected");
   }
}

However, I don't know how to use this function in an OOP way:

void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    img = loadImage(selection.getAbsolutePath());
    img.loadPixels();
  }
}

Thanks for help.

How to show image using smarty, when it is stored on amazon?

My images are stored on Amazon servers and I have to display them (using smarty) in a smarty template.
currently I am able to show an image using following PHP code:

header('Content-type:image/jpeg');  
header("Content-disposition: inline; filename=\"".basename($formatted_filename)."\"");

How could I show it on smarty page?

How to have 2 same functions in Javascript for 3 different images?

This is the code that I found online from someone and used it on my own HTML code.

<script type="text/javascript">// <![CDATA[
var image=new Array("/Users/ghanimbakhit/Desktop/HTML Project/images/rock.jpg",
"/Users/ghanimbakhit/Desktop/HTML Project/images/rock2.jpg",
"/Users/ghanimbakhit/Desktop/HTML Project/images/rock3.jpg");


var timeout={};
function stopIt(){
clearTimeout(timeout);
}
function changeimage(dvX){
var dvi=document.getElementById(dvX);
if(!dvi.count || dvi.count == image.length )
dvi.count=0;
dvi.src=image[dvi.count];
dvi.alt=image[dvi.count];
dvi.count=dvi.count+1;
timeout=setTimeout('changeimage("'+dvX+'")',3500);
}
// ]]></script>

And this is the body

<body onload="changeimage('changer')">
<div style="position:absolute;top: 600px"  ><img width="350" src="t1 alt="Rock Climbing"  id="changer"/></div>

This code is used to automatically change images in a few seconds, and I chose it so for some images "rock,rock2,rock3". I have 2 more images that I want the same function to be done with. How can I do that without overriding the above code? Im new to Javascript.

If anything more is needed please do notify me, I have to submit this in 3 hours. Thank you

Figcaption Not Aligning Correctly Under Image

I'm trying to layout 3 pictures one straight after another on the same line, each having their own 'Figcaption'. But the figcaption as seen in the image below is completely not centered and the figure area is not aligned correctly with the image either. I need the figure to take up exactly the same space as the image otherwise it's pushing the other images to the next line which I don't want happening. So basically, what would be the best way about setting the specific 131px size for the figure and then making the figcaption exactly aligned with the image when I set the text to align in the center?

Image of Problem - http://ift.tt/1blpMJh (The Figure is not aligned at all with the image)

HTML:

<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>Lakeside Books</title>
    <link rel="stylesheet" type="text/css" href="masterstyle.css">
    <meta name="viewsize" content="width-device-width,initial-scale=1.0">

    <!--[if IE]>
    <script type="text/javascript" src="_http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

</head>

<body>
<div id="wrapper">
    <div id="sidebar">
        <nav id="nav">
            <h3 id="welcometext">Welcome To<br>Lakeside Books</h3>
            <div id="searchbar">
                <form action="http://ift.tt/1piqnAa">
                    <input type="text" name="search" placeholder="...Search Book Title"/>
                </form>
            </div>
            <ul>
                <li>
                    <a class="link">
                        Home
                    </a>
                </li>
                <li>
                    <a class="link">
                        Categories
                    </a>
                </li>
                <li>
                    <a class="link">
                        Bestsellers
                    </a>
                </li>
                <li>
                    <a class="link">
                        Contact
                    </a>
                </li>
            </ul>
        </nav>
    </div>

    <div id="sectionone">
        <div id="containerone">
            <div id="header">
                <div id="logo">
                    <h1>LAKESIDE BOOKS</h1>
                    <p>KERRYS LOCAL BOOKSTORE</p>
                </div>
            </div>
        </div>
    </div>

    <div id="sectiontwo">
        <div id="containertwo">
            <h2 id="sectwohead">Best Selling Books Right Now</h2>
                <div id="bestsellerimages">
                    <figure>
                        <img src="Images/4.jpg" alt="book1" height="200" width="131">
                        <figcaption>The Girl On The Train - Paula Hawkins</figcaption>
                    </figure>
                    <figure>
                        <img src="Images/3.jpg" alt="book2" height="200" width="131">
                    </figure>
                    <figure>
                        <img src="Images/5.jpg" alt="book1" height="200" width="131">
                    </figure>
                </div>
        </div>
    </div>

</div>
</body>
</html>

CSS:

html, body { /* ### */
    margin:0;
    padding:0;
    height:100%;
    width:100%;
}
body {
    background-color: #fdfdfd;
    font-family: Arial, "Open Sans", sans-serif-light, sans-serif, "Segoe UI";
}
#wrapper {
    width: 100%;
    height: 100%;
    margin:0 0 0 20%; /* ### */
}
#sidebar {
    background-color: #212528;
    position: fixed;
    width: 20%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}
#nav {
    color: #DADADA;
    display: block;
    max-width: 100%;
}
#nav ul {
    padding-left: 0;
}
#nav li {
    list-style-type: none;
    margin: 0;
    padding: 0.75em 0 0.75em 0;
    text-align: center;
    max-width: 100%;
}
#nav li:hover {
    background:#333;
}
#nav li a {
    display: block;
    padding: 0.5em 0;
}
.link {
    text-align: right;
    margin-right: 25%;
    letter-spacing: 1px;
}
#welcometext {
    text-align: center;
    font-style: italic;
    text-transform: uppercase;
    font-size: 1em;
    margin-top: 2em;
}
#searchbar {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    padding: 1em 1em 0.5em 1em;
    text-align: right;
}
#searchbar input {
    max-width: 95%;
}
#sectionone {
    /*position: fixed;*/
    top: 0;
    right: 0;
    width: 80%;
}
#containerone {
    margin-top: 0;
    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    border-bottom: 2px solid #DADADA;
    box-shadow: inset 0 -6px 0 0 #fdfdfd, inset 0 -8px 0 0 #DADADA;
}
#header {
    margin: 6em 0 6em 0;
}
#logo h1 {
    color: #ed786a;
    text-shadow: 0.1em 0.1em 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 13px;
}
#logo p {
    margin-top: -0.6em;
    color: #888888;
    letter-spacing: 4px;
    font-size: 0.85em;
}
#sectiontwo {
    width: 80%;
    top: 0;
    right: 0;
}
#containertwo {
    width: 80%;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
#sectwohead{
    margin: 2em 0 2em 0;
    color: #888888;
}
#bestsellerimages{
    float: left;
    display: inline-block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 2em 0;
}
#bestsellerimages img{
    padding: 0 1em 0 1em;
}
#bestsellerimages figure{
    display: inline-block;
    width: 131px;
}

How to use image in WPF as resource?

I was googling, but I have not found what I need. I tried to use this code to use image resource(build action setted):

BitmapImage bi3 = new BitmapImage();
        bi3.BeginInit();
        bi3.UriSource = new Uri(@"Resources\wall.png", UriKind.RelativeOrAbsolute);
        bi3.EndInit();

it throws filenotfoundexception

Effecient algorithms for image pixel manipulations

Is there any efficient method to access and change image pixels than the usual scanning the pixel array and changing them? I've a psuedocode but I want a a better method than this. I just need an algorithm, any language is fine. It looks something like this:-

   For i in range(0,len(pixel_array),4)
       pixel_array[0] = a   //a is some random value
       pixel_array[1] = a
       pixel_array[2] = a
       pixel_array[3] = 1

Adding an image in a Joomla module adds an awful tag and border

i designed a simple website using joomla and i'm currently using beez3 template. i would like to add a simple image that can be clicked (as a hyper textual link) inside a module and place such module in a given position inside my template.

for such purpose, i created a new custom html module and placed inside it the following code:

<p><a href="http://ift.tt/1F7udTx">
<img src="images/hotel.jpg" alt="" width="250" height="180" /></a></p>

the image appears correctly where i wish, but it's surrounded by a kind of tab, whose title is the same i chose for module, that can be clicked, even if nothing happens when i do it. Here's how image appears, surrounded by tab (PARTNERS is the title i chose for module) tab surrounding image

do you know how to remove such tab and its borders surrounding image?

thanks for help.

How can I preview image before uploading with the correct orientation with JavaScript?

I have a upload button and I want users being able to preview the image before clicking 'save'. I have

<input type="file" accept="image/*" id="avatarInput" onchange="PreviewImage();"/>

as my HTML and for my JS:

      function PreviewImage() {
            var oFReader = new FileReader();
            oFReader.readAsDataURL(document.getElementById("avatarInput").files[0]);                

            oFReader.onload = function (oFREvent) {
                $('.image').attr('src', oFREvent.target.result);
            };
        };

But now, when I try to upload portrait image on my mobile, the preview image is rotated 90 degree. How can I cope with this? I've seen this and this but I don't know the codes can be incorporated in my case. Thanks.

image does not load (HTML)

I have a very simple question : my image does not load with that simple code.. do you have any explanation ?

<!DOCTYPE html>
<html>
   <body>
     <h2>my image</h2>
         <img src="C:\Users\Public\Pictures\Sample Pictures\desert.jpg" alt="image"/>
   </body>
</html> 

Note : i am working locally on my computer using WampServer

I am 100% sure of the path (it displays the image if I copy/paste it directly in the url bar of firefox). I also tried to put the image directly in the same folder as the html file... I tried with firefox/chrome/IE with no success.

Something strange though : it works if I use online image...

Image/IO Loop over image (C)

I am attempting to convert a PPM image to PGM and loop through the image at each pixel do double avg etc...

#include <stdio.h>
#include "image-io.h"
int main(int agrc, char **argv)
{
    int i, j;
    if (agrc != 3) {
        fprintf(stderr, "Usage: %s infile outline\n", argv[0]);
        fprintf(stderr, "Reads PGM or PPM from infile,"
                "writes identical image to outline \n");
        return EXIT_FAILURE;
    }
    pm_init(argv[0], 0);
    struct image *img = read_image(argv[1]);
    fprintf(stderr, "input image is %dx%d, depth=%d, maxval=%d\n",
            img->pam.height, img->pam.width,
            img->pam.depth, (int) img->pam.maxval);
    img->pam.format = RPGM_FORMAT;
    img->pam.depth  = 1;
    for ( i  = 0 ; i < img->pam.height; i++) {
        for ( j = 0 ; j < img->pam.width; j++) {
            double avg = (img->r[i][j] +img->g[i][j] + img->b[i][j]) /3.0;
            img->g[i][j] = (int) (0.5 + avg);
        }
    }




    write_image(argv[2], img);
    free_image(img);
    return EXIT_SUCCESS;
}

I am having issue looping over the image

Owl Carousel - caption div (img title & alt tags)

I'm looking for a way to display the img title & alt tags in a div (.image-caption).

This is my code so far:

    owl.on('changed.owl.carousel', function(event) {

        var comment = $(this).find('img').attr('alt');
        var title = $(this).find('img').attr('title');
        if(comment) $('#desktop .image-caption').html('<h4>'+title+'</h4><p>'+comment+'</p>');

    })      

Any ideas? Thanks!

display image in different resolution

I have created an sample code to see an image in different resolution such as tablet, mobile and desktop, the code is working but actually I want to see all these resolution within the desktop itself which is not working . My code is as given below

Can anyone please tell me some solution for this.

JSFiddle

Css

@media only screen and (max-width : 480px) {
   /* Smartphone view: 1 tile */
   .box1 {
      width: 480px;
      padding-bottom: 100%;
   }
}
@media only screen and (max-width : 650px) and (min-width : 481px) {
   /* Tablet view: 2 tiles */
   .box2 {
      width: 50%;
      padding-bottom: 50%;
   }
}
@media only screen and (max-width : 1050px) and (min-width : 651px) {
   /* Small desktop / ipad view: 3 tiles */
   .box3 {
      width: 33.3%;
      padding-bottom: 33.3%;
   }
}
@media only screen and (max-width : 1290px) and (min-width : 1051px) {
   /* Medium desktop: 4 tiles */
   .box4 {
      width: 25%;
      padding-bottom: 25%;
   }
}

Enhanced image plugin not working correctly when custom styles have been applied

For my website we use custom style sheets that are stored locally on our server and are injected into the webpages. However when i add them to CKEditor and then attempt to resize or move an image with the enhanced image plugin they cannot be resized or moved at all. Has anyone encountered this problem before? Is there anyway around it?

Crossfade Images on Body

Building a WordPress theme and trying to crossfade multiple background images on the body tag and not on a div! I have been trying to use the tutorial here: http://ift.tt/1o25R5v | Demo 3 with no success

Is it possibe to do without javascript and jquery and just use css only! Currently my Body css looks like this....

body {
    font-family: 'Arial', courier, sans-serif;
    background:url('ASSETS/bg2.jpg')no-repeat top left;
    background-size:cover;
    background-attachment:fixed
}

I do have another image to crossfade in my ASSETS folder called bg.jpg.

Qt/QML. A way to learn image size without load

amigos!

The problem is as follows: I have a set of images (url addresses). Some of them are of acceptable size, but some are too big. When I load it, app crashes because of big images. Is there a way to learn image size (megabytes) preliminarly? This way I can remove large images from the list, avoiding it to be loaded.

Thanks for attention.

Adjusting Image Size with CSS For Mobile Website

  • I am having trouble adjusting images in blog articles in mobile theme. Somehow they are messing up the layout. I use the following code for images in articles.

    1) <div class="leftbox"><img src="http://.mysite.net/blog/media/Photo/Indian_tourists.jpg" width="400" height="267" alt="Indian tourists" title="Indian tourists" /></div>

    2) <div style="text-align: center"><img src="http://ift.tt/1J2yaLv" width="520" height="347" alt="Surfing in France" title="Surfing in France" /></div>

    I have added these codes to ensure that images don't alter the width but it seems they are not working.

    .post_content img { height: auto !important; max-width: 100% !important; }

    .leftbox img { height: auto !important; max-width: 100% !important; }

This is example of a link where image would stretch on mobile devices - http://ift.tt/1JmlNqx

Changing the position of an image inside another image

I need your help please. I'm working in Matlab and I have tow images one with size 256*256 and the other one with size 64*64. I want to embed the small image into the first one but i would like to control the position of the embedding process. For example having the small image in the corner of the big image and then I want to change it in the middle ... do you have any idea how ? thank you

Cant find out why i'm getting null pointer exception, can anybudy help me?

My task is to upload image & display path of the image to the user, i have the following snippet but its not showing the path of the image, instead it is throwing null pointer exception in at the location of storage path, though i put generic as default path

  try {
            String storagePath ="generic";
            //String storagePath ="";
            if(storagePath!= null)
            {
            if (fileType.equalsIgnoreCase("emailTemplateImagePathUrl")
                    || fileType.equalsIgnoreCase("images"))
                storagePath = configurationSettings
                        .getEmailTemplateImagePathUrl();
            else if (fileType.equalsIgnoreCase("profileImagePathUrl"))
                storagePath = configurationSettings.getProfileImagePathUrl();
            else if (fileType.equalsIgnoreCase("imagePathUrl"))
                storagePath = configurationSettings.getImagePathUrl();
            else if (fileType.equalsIgnoreCase("postsImagePathUrl"))
                storagePath = configurationSettings.getPostsImagePathUrl();
            else if (fileType.equalsIgnoreCase("mantrasImagePathUrl"))
                storagePath = configurationSettings.getMantrasImagePathUrl();
            else if (fileType.equalsIgnoreCase("zodiacSignImagePathUrl"))
                storagePath = configurationSettings.getZodiacSignImagePathUrl();
            else if (fileType.equalsIgnoreCase("assetsBaseURL"))
                storagePath = configurationSettings.getAssetsBaseURL();
            else if (fileType.equalsIgnoreCase("assetsFolderName"))
                storagePath = configurationSettings.getAssetsFolderName();
            else if (fileType.equalsIgnoreCase("imagesFolderName"))
                storagePath = configurationSettings.getImagesFolderName();
            else if (fileType.equalsIgnoreCase("templeAssetsPrimaryFolderName"))
                storagePath = configurationSettings
                        .getTempleAssetsPrimaryFolderName();
            else if (fileType.equalsIgnoreCase("templeGalleryFolderName"))
                storagePath = configurationSettings
                        .getTempleGalleryFolderName();
            else if (fileType.equalsIgnoreCase("servicesFolderName"))
                storagePath = configurationSettings.getServicesFolderName();
            else if (fileType.equalsIgnoreCase("nearByFolderName"))
                storagePath = configurationSettings.getNearByFolderName();
            else if (fileType.equalsIgnoreCase("thumbnailsFolderName"))
                storagePath = configurationSettings.getThumbnailsFolderName();

            //String folderName = "C:\\Users\\Anupd\\workspace2\\Devalayam\\WebContent\\" + storagePath + "\\" + fileName;
            String folderName = "C:\\Users\\Anupd\\workspace2\\Devalayam\\WebContent\\" + storagePath + "\\" + fileName;
            System.out.println(storagePath);
            System.out.println(folderName);
            }
            //String uploadFileLocation = folderName + storagePath + fileName;
            String uploadFileLocation = storagePath ;
            System.out.println(uploadFileLocation);
            OutputStream out = new FileOutputStream(
                    new File(uploadFileLocation));

            int read = 0;
            byte[] bytes = new byte[1024];
            while ((read = uploadInputStream.read(bytes)) != -1) {
                out.write(bytes, 0, read);
            }
            uploadInputStream.close();
            out.flush();
            out.close();

            // http://ift.tt/1J2ydae
            out = null;
            System.gc();

            File file = new File(uploadFileLocation);



            mapObject.put("fileName", fileName);
            mapObject.put("fileType", fileType);

            String strLong = Long.toString(file.getTotalSpace());

            mapObject.put("fileSize",strLong);
            } catch (IOException e) {
            e.printStackTrace();
        }
        return g.toJson(mapObject);

& the op is null

C:\Users\Anupd\workspace2\Devalayam\WebContent\null\17f96f04-169b-47e4-9128-a326adfd2e1a-medium.jpeg
null

thanks in advance

Making images appear slowly to make it realistic - Android

I created a blackjack application and I've got everything works well but I want to make the application more realistic so that the cards will show up in some pace that would resemble a real dealer card distribution. Any ideas how can I make it happen?

Background images in CSS

In each page of my website I have a section where there is the title of the webpage and where I would like to have a background image. I use different background images for most of the pages and I would like also to use a different image depending on the width of the screen of the user's device.

So this is my CSS:

#title1 {
      background-image: url("images/image1small.JPG");
   }

@media (min-width: 600px) {
    #title1 {
       background-image: url("/images/image1big.JPG");
    }
   }

In the HTML I write this:

<div id="title1">THIS IS THE TITLE</div>

So besides title1, I will have also title2, title3, etc in my CSS that will be used for other webpages. I like "my" CSS+HTML solution because it's very simple, but I am worried about the loading time of the page: is there any problem having something like 100 images listed in the CSS (even if just 2 (1 big and 1 small) are then used in each webpage)?

In another thread ( Loading CSS background images before normal images? ) I read that CSS background images are the last elements to be loaded (if I got it right), while I would like them to be the first ones. To solve this problem, I could use javascript... but at that point, is it worth having my CSS + HTML solution, or should I use javascript also to load different background images depending on the width of the screen?

I am new to CSS and HTML so I am happy to compare ideas... Thank you

Call image from Dump in real time php

I have three files first one is

First file code: Image.php

<?php
    header('Content-type: image/jpeg');

    $jpg_image = imagecreatefromjpeg('Desert.jpg');
    $white = imagecolorallocate($jpg_image, 73, 41, 236);
    $font_path = 'OpenSans-Italic.TTF';
    $text = $_GET['name'] ;
    imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);

    $image_url="dump/".rawurlencode(trim($text)).".jpg";

    imagejpeg($jpg_image,$image_url);
    readfile($image_url);
    imagedestroy($jpg_image);
?>

Second file code is :home.html

 <form action="result.php" method="get">
      <input type="text" name="name" id="name">
      <input type="button" name="submit" id="submit">
 </form>

Third file code is:result.php

<body>
    <img src="How to Get recently created image from dump folder"/>
</body>

As I have shown you I have three file one is home page and other two are of php I have added some php script on the home.html which redirects me to the result.php page. The function of image.php is to make a picture with some text on it which we will get from the user through input tag and as you know I have dump that image in an dump folder on my website. As we all know that we cannot write html in the image.php because it containsheader('content-type: image/jpeg'); so i have created a new file name result.php which will show the image which is named as what the user has inputed in the input tag and now i want to show it in the result.php and i dont know what user has given the name of image it is stored in dump folder of my website so how to get that dump image from the website and also check weather my coding is correct.

Android image scale to Listview items

I am setting up a ListView that should hold rows, with an image thumbnail and text. I would like to show 5 rows on the screen, and scale the images to the available space depending on the device.

I have made the following layout xml files. First one holds the ListView, and the second the list item. I am currently setting a fixed size. How could I change the layout to scale images to adapt to the screen size?

Setting up the ListView:

<FrameLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"" >

    <ListView
    android:id="@+id/gallery"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    </ListView>

</FrameLayout>

The list item layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
 android:layout_width="match_parent"
 android:layout_height="fill_parent"
 android:orientation="horizontal" >
 <ImageView
 android:id="@+id/icon"
 android:layout_width="50dp"
 android:layout_height="50dp"
 android:layout_marginBottom="5dp"
 android:layout_marginLeft="5dp"
 android:layout_marginRight="5dp"
 android:layout_marginTop="5dp"
 android:src="@raw/pic01" />

 <TextView
 android:id="@+id/textview"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textSize="20sp" 
 android:paddingTop="5dp"/>

</LinearLayout>

Matlab - figure draw limit

I am writing a code that visualizes temperature changes on a drawing and can't overcome a problem that appears. Any help would be really appreciated, I couldn't find anything about it anywhere. The code is long, but in short: there is a big 'while' loop in which colored dots and corresponding temperatures are drawn on the 3 figures. The plot moves and shows some statistics, this is for a 24h+ streak of measurements, so ~1500+ points of data. Everything goes smoothly until something, I'm not sure, breaks? after about 1000 points of data. Maybe it's a memory leak, I have no idea as I've never encountered this before. Some lines disappear, all the drawn text data dissapears, the text font changes, plot lines become thicker and circle boundaries become thinner. Has anyone encountered something similar and knows how to deal with this problem? I can not attach an image file because of a new account, but I wrote a link to a file which shows a comparison between what it should look like and what it looks like after something weird happens.

http://ift.tt/1bkn3Qo

Image Buttons into another form

can you tell me how to click a picture button as a character and send it into another form as a picture button. Please any code would be appreciated thanks Gaz.

React Native Image element crashing with a URI location

I'm trying to display an image with a URI location instead of a static image and it's not working. I'm getting the red screen with the message: 'You are trying to render the global Image variable as a React element. You probably forgot to require Image.' I simply took the default project (react-native init awesomeProject) and added this inside the View after the two Text elements:

<Image 
    style = {styles.base}
    source={{uri: 'http://ift.tt/MIVljy'}}
/>

and I enhanced the styles with an additional property:

base: {
    height: 400,
    width: 400 
},

I can't figure out why this wouldn't work as this is the simple example in the React Native docs. Any advice?

how to display base64 images in ie9, image cuts when dipslay

I get base64 image string and want to display in IE, I am using pretty photo gallery.

I am trying to convert base64 to binary image but it cannot work for me.

javafx rotating circle while loading

I have a method wich loads some data and this can take a while, the problem is that you can still click on things and this might crash the programm. So I am looking for a specific implementation of a loading-circle when you click on a button and the method starts.

Getting map details on zooming

I have seen some maps lately (.jpg, .gif etc), the surprising thing is upon zooming the image datails become clearer, I use qgis and mapInfo for GIS and even after saving my mapInfo project to (.jpg and co), I still do not get the details upon zooming. I know a high detailed/pixel map will provide precision upon zooming but after removing the picture layer before saving with mapInfo, I was expecting everything to be correct, but it was not.

Am I missing something? What can I do? Any suggestions are welcome.

PHP video/image download script

I am developing video and image downloading site,and i am almost close to complete it,but i am facing 1 problem with downloading code,the code through which video/image will be downloaded is working properly,but the problem is when i play that downloaded video then it shows Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file. not only windows media player but all the video players gives error like this,so can anyone tell me,where is the problem?

PHP code:

<?php

session_start();

echo $f = $_SESSION['str'];

define('ALLOWED_REFERRER', '');

define('BASE_DIR','/xampp/htdocs/Testing/');

define('LOG_DOWNLOADS',true);

define('LOG_FILE','downloads.log');

$allowed_ext = array (


  'zip' => 'application/zip',


  'pdf' => 'application/pdf',
  'doc' => 'application/msword',
  'xls' => 'application/vnd.ms-excel',
  'ppt' => 'application/vnd.ms-powerpoint',


  'exe' => 'application/octet-stream',


  'gif' => 'image/gif',
  'png' => 'image/png',
  'jpg' => 'image/jpeg',
  'jpeg' => 'image/jpeg',


  'mp3' => 'audio/mpeg',
  'wav' => 'audio/x-wav',


  'mpeg' => 'video/mpeg',
  'mpg' => 'video/mpeg',
  'mpe' => 'video/mpeg',
  'mov' => 'video/quicktime',
  'avi' => 'video/x-msvideo',
  'm4v' => 'video/m4v',
  '3gp' => 'video/3gp',
  'wmv' => 'video/wmv',

);

if (ALLOWED_REFERRER !== ''
&& (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper(ALLOWED_REFERRER)) === false)
) {
  die("Internal server error. Please contact system administrator.");
}

set_time_limit(0);

if (!isset($f) || empty($f)) {
  die("Please specify file name for download.");
}

if (strpos($f, "\0") !== FALSE) die('');

$fname = basename($f);

function find_file ($dirname, $fname, &$file_path) {

  $dir = opendir($dirname);

  while ($file = readdir($dir)) {
    if (empty($file_path) && $file != '.' && $file != '..') {
      if (is_dir($dirname.'/'.$file)) {
        find_file($dirname.'/'.$file, $fname, $file_path);
      }
      else {
        if (file_exists($dirname.'/'.$fname)) {
          $file_path = $dirname.'/'.$fname;
          return;
        }
      }
    }
  }

}

$file_path = '';
find_file(BASE_DIR, $fname, $file_path);

if (!is_file($file_path)) {
  die("File does not exist. Make sure you specified correct file name."); 
}

$fsize = filesize($file_path); 

$fext = strtolower(substr(strrchr($fname,"."),1));

if (!array_key_exists($fext, $allowed_ext)) {
  die("Not allowed file type."); 
}

if ($allowed_ext[$fext] == '') {
  $mtype = '';

  if (function_exists('mime_content_type')) {
    $mtype = mime_content_type($file_path);
  }
  else if (function_exists('finfo_file')) {
    $finfo = finfo_open(FILEINFO_MIME); 
    $mtype = finfo_file($finfo, $file_path);
    finfo_close($finfo);  
  }
  if ($mtype == '') {
    $mtype = "application/force-download";
  }
}
else {

  $mtype = $allowed_ext[$fext];
}

if (!isset($_GET['fc']) || empty($_GET['fc'])) {
  $asfname = $fname;
}
else {

  $asfname = str_replace(array('"',"'",'\\','/'), '', $_GET['fc']);
  if ($asfname === '') $asfname = 'NoName';
}

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $mtype");
header("Content-Disposition: attachment; filename=\"$asfname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);

$file = @fopen($file_path,"rb");
if ($file) {
  while(!feof($file)) {
    print(fread($file, 1024*8));
    flush();
    if (connection_status()!=0) {
      @fclose($file);
      die();
    }
  }
  @fclose($file);
}

if (!LOG_DOWNLOADS) die();

$f = @fopen(LOG_FILE, 'a+');
if ($f) {
  @fputs($f, date("m.d.Y g:ia")."  ".$_SERVER['REMOTE_ADDR']."  ".$fname."\n");
  @fclose($f);
}

?>

Trouble with React Native Image element handling URI based image location

I'm trying to display an image with a URI location instead of a static image and it's not working. I'm getting the red screen with the message: 'You are trying to render the global Image variable as a React element. You probably forgot to require Image.' I simply took the default project (react-native init awesomeProject) and added this inside the : http://ift.tt/MIVljy'}} /> And I enhanced the styles to include: base: { height: 400, width: 400 },

I can't figure out why this wouldn't work as this is the example in the React Native docs. Any advice?

iOS Custom Keyboard with Images instead of letters

I have to implement a custom Keyboard with Images instead of letters, exactly like that one Ikea Emoticons App

I've tried some tutorials and examples but everything I've found is for making custom keyboards without Images (just with letters).

I just need to show some Images, and send the selected one as an Image.

Any ideas about how is it implemented in the IKEA app for example?

Here is what I have tried:

AppCoda custom Keyboard

WUEmoticonsKeyboard

I am using Chrome and cant get image to show from mysql using php

Firstly I know I shouldn't put the image in a DB but I am still learning.

I want to show the image, where am I going wrong?

In my database I have a column Image that is a BLOB. Small sized image. And I've checked an image array is there.

After I connect the db here is the php

$result = mysql_query("SELECT Image FROM table WHERE ID = 1");
$row = mysql_fetch_array($result);
echo $row["image"];

Any help appreciated.

All I want is just the image to show. Nothing fancy as I will expand on it once I get an image up on the screen.

I think I need an extra step between fetch array to split a variable that contains just the image and to display that. This is where I get lost.

Cheers.

This is the code I use to update the DB (from a form)

  $myphoto = $_FILES['MyPhoto'];
  $query = mysql_query("UPDATE table SET Image = '$myphoto' WHERE ID = 1") or die(mysql_error());

trouble using media query to switch divs with background images from columns to rows

I am a first-time coder. I am trying to design a prototype gallery and comics nav page that will switch divs from columns to rows depending on the screen size. I attempted to do this with a media query. The divs appear to change all right, but I do not know why they lose their background images in the process.

Everything CSS-related works just like I want it to before the media query kicks in, whether I design it columns-first or rows-first. Once I resize the browser to get the alternate view the images disappear. If anyone can explain why this is happening, and/or suggest a better route, I would be -extremely- grateful.

Pictures, because I don't have a live site yet: http://ift.tt/1cK2RYy

Code from the desktop to mobile site, if it will help at all.

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Desktop to Mobile</title>
    <style type="text/css">
      body {
        background-color: rgba(0,153,153,1);
      }
      body,td,th {
        color: rgba(255,255,255,1);
      }
      #apDiv1 {
        position: absolute;
        left: 0%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 1;
        background-image: url(_ImagesMain/1.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv2 {
        position: absolute;
        left: 25%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 2;
        background-image: url(_ImagesMain/2.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv3 {
        position: absolute;
        left: 50%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 3;
        background-image: url(_ImagesMain/3.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv4 {
        position: absolute;
        left: 75%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 4;
        background-image: url(_ImagesMain/4.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv5 {
        position: absolute;
        left: 175%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 9;
        background-image: url(_ImagesMain/4.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv6 {
        position: absolute;
        left: 100%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 6;
        background-image: url(_ImagesMain/1.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv7 {
        position: absolute;
        left: 125%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 7;
        background-image: url(_ImagesMain/2.jpg);
        background-size: cover;
        background-position: center;
      }
      #apDiv8 {
        position: absolute;
        left: 150%;
        top: 0px;
        width: 25%;
        height: 100%;
        z-index: 8;
        background-image: url(_ImagesMain/3.jpg);
        background-size: cover;
        background-position: center;
      }
    </style>
    <!-- Mobile -->
    <link href="_CSS/Mobile_CSS.css" rel="stylesheet" type="text/css" media="only screen and (max-width:800px)">
  </head>

  <body>
    <div id="apDiv1">Comics</div>
    <div id="apDiv2">Gallery</div>
    <div id="apDiv3">Forum</div>
    <div id="apDiv4">Store</div>
    <div id="apDiv5">Blog</div>
    <div id="apDiv6">Patreon</div>
    <div id="apDiv7">Commission</div>
    <div id="apDiv8">Links</div>
  </body>
</html>

The Mobile_CSS.css Referred to:

@charset "utf-8";
#apDiv1 {
  position: absolute;
  left: 0%;
  top: 0%;
  width: 100%;
  height: 25%;
  z-index: 1;
  background-image: url(_ImagesMain/1.jpg);
  background-size: cover;
}
#apDiv2 {
  position: absolute;
  left: 0%;
  top: 25%;
  width: 100%;
  height: 25%;
  z-index: 2;
  background-image: url(_ImagesMain/2.jpg);
  background-size: cover;
}
#apDiv3 {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 100%;
  height: 25%;
  z-index: 3;
  background-image: url(_ImagesMain/3.jpg);
  background-size: cover;
}
#apDiv4 {
  position: absolute;
  left: 0%;
  top: 75%;
  width: 100%;
  height: 25%;
  z-index: 4;
  background-image: url(_ImagesMain/4.jpg);
  background-size: cover;
}
#apDiv5 {
  position: absolute;
  left: 0%;
  top: 175%;
  width: 100%;
  height: 25%;
  z-index: 9;
  background-image: url(_ImagesMain/4.jpg);
  background-size: cover;
}
#apDiv6 {
  position: absolute;
  left: 0%;
  top: 100%;
  width: 100%;
  height: 25%;
  z-index: 6;
  background-image: url(_ImagesMain/1.jpg);
  background-size: cover;
}
#apDiv7 {
  position: absolute;
  left: 0%;
  top: 125%;
  width: 100%;
  height: 25%;
  z-index: 7;
  background-image: url(_ImagesMain/2.jpg);
  background-size: cover;
}
#apDiv8 {
  position: absolute;
  left: 0%;
  top: 150%;
  width: 100%;
  height: 25%;
  z-index: 8;
  background-image: url(_ImagesMain/3.jpg);
  background-size: cover;
}

Generate an image via PHP

I want to generate an image via php. I've already done it with a POST request that sends a base64 code representing the content of a canvas to a php file.

JS:

var canvas = document.getElementById("myCanvas");
    var dataURL = canvas.toDataURL("image/jpeg", 0.2);
    console.log(dataURL);

    // post the dataUrl to php
    $.ajax({
        type: "POST",
        url: "upload.php",
        data: {image: dataURL}
        }).done(function( respond ) {
            // you will get back the temp file name
            // or "Unable to save this image."
            console.log(respond);
});

PHP:

<?php
if ( isset($_POST["image"]) && !empty($_POST["image"]) ) {
    $dataURL = $_POST["image"];
    $parts = explode(',', $dataURL);  
    $data = $parts[1];
    $data = base64_decode($data); 
    // create a temporary unique file name
    $file = "img/" . UPLOAD_DIR . uniqid() . '.png';
    // write the file to the upload directory
    $success = file_put_contents($file, $data);
    // return the temp file name (success)
    // or return an error message
    print $success ? $file : 'Unable to save this image.';
}
?>

I've looked to some similar sites and I've found out that they're doing the same thing with a different approach. They send a GET request to a php file, and they just send some datas (for example, the User name that has to be printed on the canvas).

My point is: speaking only about the server's performance, what is the best choice? If the best is second one, how can I achieve that result with GET? Where I've to put the canvas?

How to make sort gallery thumbnails image by date

i developing one android applicaiton. This application get all thumbnail images in gallery. i want to sort by date but i can't do this action.

Please help me.

Get all images

// Set up an array of the Thumbnail Image ID column we want
String[] columns = {MediaStore.Images.Media._ID};

String orderBy = MediaStore.Images.Thumbnails._ID + " DESC LIMIT 10";

// Create the cursor pointing to the SDCard

cursor = getActivity().managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
        columns, // Which columns to return
        null,       // Return all rows
        null,
        orderBy);

// Get the column index of the Thumbnails Image ID
columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);

myGalleryImages = (GridView) view.findViewById(R.id.my_gallery);
myGalleryImages.setAdapter(new ImageAdapter(getActivity()));

set images

    // Move cursor to current position
    cursor.moveToPosition(position);
    // Get the current value for the requested column
    int imageID = cursor.getInt(columnIndex);
    // Set the content of the image based on the provided URI
    holder.image.setImageURI(Uri.withAppendedPath(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, "" + imageID));

Attach 3 images in single slide at specified positions using Apache POI XSLF

I need to paste 3 pictures in single slide using Apache POI XSLF. However I could able to add only one picture in a slide. Also I could not find any ways to specify the size and orientation the picture should be.

Tried the following code

    XMLSlideShow ppt = new XMLSlideShow();
    XSLFSlide slide = ppt.createSlide();
    XSLFGroupShape group1 = slide.createGroup();
    byte buf[] = new byte[1024];

    for (int i = 1; i <= 2; i++) {
        byte[] pictureData = IOUtils.toByteArray(new FileInputStream(
                "C:\\Users\\Ashok\\Pictures\\" + i + ".png"));
        int elementIndex = ppt.addPicture(pictureData,
                XSLFPictureData.PICTURE_TYPE_PNG);
        XSLFPictureShape picture = slide.createPicture(elementIndex);
        List<XSLFPictureData> allPictures = ppt.getAllPictures();
        System.out.println(allPictures.size());
    }
    FileOutputStream fos = new FileOutputStream("C:\\test2.pptx");
    ppt.write(fos);
    fos.flush();
    fos.close();

The above code contains only the last image.

Trying to echo an Image from BLOB

I have a page where a user enters an ID for a book record and it is supposed to pull the corresponding image (only the image) that was entered with a books details from the database which is stored as a BLOB. - Yes, its better to store the image file path - I know this, but that's not what i'm trying to achieve here.

Currently when I press the submit button to find an ID specific by user it displays a page with an image symbol, but no image.

Here is my code.

require_once __DIR__.'/config.php';
session_start();
$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_USERNAME, DB_USERNAME, DB_PASSWORD);

$book = $_POST["book_id"];
$stmt = $dbh->prepare("select image from books2 where b_id = $book ");
$stmt->execute();


if ($stmt) {
    if ($row = $dbh->prepare($stmt)) {
       $img = $row["image"];
    }
}

header("Content-type: image/jpeg");

echo "$img";

How do I get the image to display, I have read other questions but haven't been able to figure it out?

Show loading gif while image is loading

I made some code where the user can upload some images from a zip. On the next page I need to show all the images seperatly in a 85*85 px frame.

The problem is that it may take some time for all the images to load. So I want to show a loading gif while the user waits for the image to load.

I've set the src of the images to be the loading gifs, while I created some checkboxes with the real source as id

echo "<td><img src=\"beelden/ajax-loader-black-16.png\" id=\"img".$image."\" style=\" width: 85px; height: 85px; border: 1px solid gray; background-color: #fff; padding: 10px;\">";
echo "<input type=\"checkbox\" id=\"img[".$image."]\" name=\"check_image[]\" value=\"".$filename."\" /></td>";
<input type="hidden" name="aantal" id="aantal" value="<?=$image?>" >

Then I created some javascript to check if the image is loaded, and when it is, it is supposed to replace the source of the image.

<script>
    var aantal = document.getElementById("aantal").value;
    for(var i = 0; i < aantal; i++){
        var source = document.getElementById("img["+i+"]").value;
        var img = new Image();
        img.onload = function(){
            $("#img"+i).attr('src', source);
        }();
        img.src = source;
    }
</script>

But this does not work the way I expected, I think it fires for all of the images as soon as the first one is loaded. Any ideas what I am doing wrong or how to fix this?

How to view dicom images in android?

I want to view .dcm file in my project so can please suggest me any library or way to view dicom files in android.

thanks.

Cropping image in a given square size android?

Hi I am using this library simplecropimage this works fine but i want the cropping area in a square(in this it can be resizable and rectangular) and the square can be move. i want to crop the image in a square keeping the same aspect ratio.Its a bit urgent. thank you so much.

How to increase the value of a sound file like an uiimagefile

I have the following piece of code:

.h

 #import <UIKit/UIKit.h>

 @interface CardView : UIImageView

 @property (nonatomic) NSInteger pos;
 @property (nonatomic) NSInteger value;

 -(id) initWithFrame: (CGRect)frame andPosition: (NSInteger)pos andValue: (NSInteger)value;
 -(void) flip;

 @end

.m

#import "CardView.h"

@interface CardView()

@property (nonatomic) UIImage *frontImage;
@property (nonatomic) UIImage *backImage;

@end

@implementation CardView

// instantiate custom view subclass programmatically
-(id) initWithFrame: (CGRect)frame andPosition: (NSInteger)pos andValue: (NSInteger)value {
self = [super initWithFrame: frame];
if (self) {
    self.frontImage = [UIImage imageNamed:[NSString stringWithFormat:      @"front%ld.png", (long) (value+1)]];
    self.backImage = [UIImage imageNamed:@"back"];

    self.contentMode = UIViewContentModeScaleAspectFit;
    self.clipsToBounds = YES;
    self.userInteractionEnabled = YES;
    self.image = self.backImage;
    self.value = value;
    self.pos = pos;
  }
  return self;
 }

-(void) flip {
self.image = (self.image == self.frontImage) ? self.backImage : self.frontImage;
}

@end

Ok, seems easy. Just a frame with images. The Images get a value +1. But i can't figure it out how to do that with a sound file. i want to "link up" the image and the related sound file. the files have numbers e.g. front1,front2... and the soundless have sound1, sound2...

thanks for help!

EDIT: something like

self.audioplayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[NSURL   alloc] initFileURLWithPath: [[NSBundle mainBundle]     pathForResource:@"sfx%ld.wav", (long) (value+1)] error:NULL];

doesnt work

Filter by extensions and file names

I have this code located below. I have noticed that I am starting to add more files which is files to be filtered which is fine however now I will like to add extensions.

So anything which is a jpg, mp3 or vtr would also be excluded. TO be honest I am not sure 100% how to approach this. I have tried with no success.

$folder = scandir($path);
$files = array();
foreach($folder as $file){
    if($file == '.' OR $file == '..' OR $file == 'index.htm'  OR $file == 'index.html' OR $file == 'jpg'){}else{
        $files[$file] = filemtime($path.'/'.$file);     
    }
}

JQuery repositioning of image inside another image after zoom

I have an image(main image) say, of height and width 300 and 500 respectively. Inside that image I have a pointer image for hotspot which starts at 60% of width and 40% of height. The percentage has been calculated as:

    xFact = parseFloat(((dotX * zoom))/imgW);
    yFact = parseFloat(((dotY * zoom))/imgH);
    console.log("yFact : " + yFact);
    xPercentage = parseFloat(xFact * 100);
    yPercentage = parseFloat(yFact * 100);

But when this image is zoomed the co-ordinates gets shifted and does not point to the actual location where it was positioned before zoom, Image and its point before zoom.Image and its point before zoom

Image and its point after zoom out.enter image description here

Placing the entire code here:

<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.9.0.min.js"></script>
<style>
</style>
</head>
<body>
<br />
<br />
<br />
<br />
<div style="text-align:center">
<div id="yourdiv" style="position: relative; display: inline-block;">
<img id = "mainImg" src="xc.jpg" style="position: relative; display: inline-block;"/>
</div>
<br />
<br />
<input type='button' value='ZoomIn' id='btn1' onclick="ZoomIn()">
<input type='button' value='ZoomOut' id='btn2' onclick="ZoomOut()">
<p id="demo"></p>
</div>

<script>
var imgW;
var imgH;
var offset;
var xPercentage;
var yPercentage;
var xFact;
var yFact;
var zoom = 1;
var dotX = 308;
var dotY = 245;
var hpX = 23;
var hpY = 22;

$( document ).ready(function() {
        $("#mainImg").load(function(){          
                imgW = $("#mainImg").width();
                imgH = $("#mainImg").height();  

                xFact = parseFloat(((dotX * zoom))/imgW);
                yFact = parseFloat(((dotY * zoom))/imgH);
                console.log("yFact : " + yFact);
                xPercentage = parseFloat(xFact * 100);
                yPercentage = parseFloat(yFact * 100);
                console.log("xPercentage : " + xPercentage + " yPercentage : " + yPercentage);
                
                $('#yourdiv').append( 
  '<img id="child" src="hotspoticonred.png" style="position: absolute;width: auto;height: auto;top:'+yPercentage+'%;left:'+xPercentage+'%;z-index: 100;"/>');
    });
});

$( window ).resize(function() {
        $("#mainImg").load(function(){
                imgw = $("#mainImg").width();
                imgh = $("#mainImg").height();  
                
    });
});

function Zoom(state) {
        
        if (state ==  true) {
                zoom = parseFloat(zoom + .1);
        } else {
                zoom = parseFloat(zoom - .1);
        }

        jQuery('#mainImg').css('-webkit-transform', 'scale('+ zoom +','+ zoom +')');
        jQuery('#yourdiv').css('-webkit-transform', 'scale('+ zoom +','+ zoom +')');
        var matrix = new WebKitCSSMatrix(getComputedStyle($('#mainImg')[0]).webkitTransform);
        console.log("new width : " + ($('#mainImg').width()* matrix.a) + "new height : " + $('#mainImg').height()*matrix.d);
        imgW = $('#yourdiv').width() * matrix.a;
        imgH = $('#yourdiv').height() * matrix.d;
        
        console.log("zoom : " + zoom +"imgW : " + imgW + " imgH : " + imgH);
        console.log("zoom : " + zoom +"dotX : " + imgW*xFact + " dotY : " + imgH*yFact);

        
        $('#yourdiv').append( 
  '<img id="child" src="hotspoticonred.png" style="position: absolute;width: auto;height: auto;top:'+yPercentage+'%;left:'+xPercentage+'%;z-index: 100;"/>');
}

function ZoomOut() {
        Zoom(false);
}


function ZoomIn() {
        Zoom(true);
}




</script>

</body>
</html>

Please suggest where am I going wrong.Thanks in advance.

How to label images in meteorJS application

I want to label images through your defined tags in meteor application. I went through the following packages: yogiben & meteor-simple-schema but was not able to find something concrete.

Additionally, meteor schema is using

MySchema = new SimpleSchema({ firstName: { type: String, label: function () { return Session.get("lang") == "de" ? "Vorname" : "first name"; } } });

but I want the user to apply label dynamically.

how to get the images array date wise

I want to get the images array date wise, any one please help me.

e.g 14.04.2015i1.jpg and 14.04.215i2.jpg and 14.04.2015i3.jpg on 14.04.2015 and so on.

Note I am using calendar. Please set the following param for me as stated above.

/* Pop-up the date picker in a "dialog" box.  
* @param  input element - ignored 
* @param  onSelect  function - the function to call when a date is selected
* @param  settings  object - update the dialog date picker instance's settings (anonymous object) 
* @param  pos int[2] - coordinates for the dialog's position within the screen or    or event - with x/y coordinates or      *                  leave empty for default (screen centre)     
* @return the manager object     
*/  _dialogDatepicker: function(input, date, onSelect, settings, pos)  {        
var id, browserWidth, browserHeight, scrollX, scrollY, inst = this._dialogInst; 
// internal instance

Converting pointcloud2 data to opencv image

I am trying to convert data obtained from a 2D laser scanner into an openCV image. On searching online for this, I found that first I had to convert the laserscan data to pointcloud2, then the pointcloud2 to a ROS image and then the ROS image to an opencv image. Currently, I do not have access to a lidar, so I had created a node that publishes fake pointcloud2 data. However, I did not understand what organised pointcloud means. I arbitrarily set the height and width parameters to 100 each, and also assigned arbitrary RGB values to points, and I got a 100x100 image, but I do not understand how that image is a representation of my pointcloud data. Can someone please explain it?

How to get image url in .ascx?

I have an image field in Sitecore from which I need its url. In code behind I have one item:

Item contactSlide = itemHelper.GetItemByPath("/sitecore/content/AMM/Resources/Slides/Slide Contact");

In the .ascx it looks like this:

<div class="contact-section grid-padding-big" style="background-image: url(img/bg.jpg)">

I need to replace img/bg.jpg with the url of the image field of the item.

In repeaters I normally have a method in the code behind for this:

    public string GetImageUrl(Item item)
    {
        Sitecore.Data.Fields.ImageField imgField = ((Sitecore.Data.Fields.ImageField)item.Fields["Bild"]);
        if (imgField.MediaItem != null)
        {
            string mediaUrl = Sitecore.Resources.Media.MediaManager.GetMediaUrl(imgField.MediaItem);
            return mediaUrl;
        }
        return "";
    }

And in the .ascx I call it like this:

<div style="background-image:url(<%# GetImageUrl((Sitecore.Data.Items.Item) Container.DataItem) %>)"></div>

This works when using this method while in repeaters. But now I have a single item. How can I pass the item to the method to get its image url? Or is there another way to do this?

Use second image to overlay image in GUI and crop (MATLAB)

Rect = imrect(gca,[200 200 35 45]); %CREATE A RECTANGLE AT POS X,Y,HEIGHT,WIDTH - FROM VISA REQUIREMENTS
setColor(Rect,'green') %RECTANGLE TO BE GREEN BOUNDARY
setFixedAspectRatioMode(Rect,1); %DISABLE RATIO CHANGE
fcn = makeConstrainToRectFcn('Rect',get(gca,'XLim'),get(gca,'YLim')); %DISABLES RECT GOING OUT OF IMAGE
setPositionConstraintFcn(Rect,fcn); %
pos = getPosition(Rect); %GETS THE VECTOR OF THE RECTANGLE
position = wait(Rect); %WAITS
I5 = ImportedImage; %IMAGE IN HANDLES.AXES1 DEFINED AS I5 USING GLOBAL VARIABLE
Crop = imcrop(I5,position); %CROP IMAGE WITH 2 INPUT ARGUMENTS

This is the code I already use to crop an image in the GUI axis. I would like to import a PNG image that I have created (Made a rule of thirds image) and use that to overlay on top of the image that is loaded into the GUI. Once loaded adjust the size of the PNG and use that to crop the image below?

I have tried reading the image in and defining that as 'Rect', but it does not show on top of the image.

Any way of getting around this? Alternatively, can MATLAB make a rule of thirds Rect? Thanks.

Text on a image

I am working on a project where I have to set the text on an image. After setting the text on image, I am saving the picture. But the written text on the image is not displaying after saving. I need that the image should be saved with the over written text.
Here is my HTML Code so far:

 <!Doctype html>
 <html> 
    <head> 
     <title> Hello World </title> 
     <style> 
         .image { position: relative; width: 100%; } 
         h2 { position: absolute; top: 200px; left: 0; width: 100%; }
     </style> 
    </head> 
    <body> 
       <div class="image"> 
           <img src="attraction/a.jpg" alt="" /> 
           <h2>Good friends are like stars</h2> 
       </div> 
    </body> 
 </html>

dimanche 19 avril 2015

Profile photos for players in iOS Game Center

I am working on a certain multiplayer game here and there's a requirement for me to show Game Center profile photos of both, the player as well as the opponent within the game.


I am using Prime31's Game Center plugin, which has the function of loadProfilePhotoForLocalPlayer that fetches your profile image but I am not able to do the same for the opponent.


Please note that I have to show these images within the game UI so I'll have to call the images as Texture2D and show them on planes.


I was able to do it very easily while working on the same game on Android with Google Plus by fetching the playerID through Prime31's PlayGameServices plugin and then passing it to a picasa link, but is there any such link for iOS Game Center as well?


Thanks in Advance.


multiple references same base64 img

Is it possible to reuse some image that is inserted in the code as base64? In my specific case, I have a list of div's, each of which has as the first element a img set by base 64. There are three or four images, but so far what I have done is loading the image like 10 or 20 times (what seems unlogical)


I was trying to do something like this:



.image1 {
src="data:img/png;base64,iVB(base64 here)..."
}

.image2 {
src="data:img/png;base64,aQp(base64 here)..."
}
.image3 {
src="data:img/png;base64,aPl8(base64 here)..."
}


and then add to each div a <img class='image1'> etc.


It requires that the image be base64, not some .png or .jpeg.


If there is another elegant way to do that I'd gladly try also.


What are the standing methods for comparing image quality?

I am trying to figure out what the standard methods for compare image quality are. I know of SNR, PSNR, RMSE, MAE, and SSIM.


However, I have also read a little bit about trying to model the human visual system because these metrics aren't the best. I've also heard about doing subjective testing, but that is not feasible for me.


Is there some standard set of image metrics are provided when comparing the quality of two images?


Image link is not clickable in responsive view

I am using bootstrap in my markup . My mark is simple , it looks like this



<div class="col-md-5 col-xs-8 col-xs-offset-2 col-md-offset-1 logo">
<a href="www.google.com">
<img src="images/new/header_logo.png" alt="Test"/>
</a>
</div>


It works fine in desktop , when I click to the image it takes me to google.com . But it doesn't work on responsive view . In responsive view if I click on the image it does nothing .


I have also tried like this



<div class="col-md-5 col-xs-8 col-xs-offset-2 col-md-offset-1 logo">
<a href="www.google.com">
<img src=images/new/header_logo.png" alt="Test" usemap="#maptest"/>
</a>
</div>
<map name="maptest">
<area shape="rect" coords="0,0,128,128" href="www.google.com" alt="Test"/>
</map>


Also I have view the following stackoverflow question , it doesn't solve my problem


Image link on iPhone is not clickable


How to add an inline image to the end of a string in a TextArea in JavaFX?

I am trying to add an emoji to my chat program when my client types :)


I am trying to add this in the FXML controller. I have captured when the user types :) using the following code snippet :



if(chat.contains(":)")) {
...
}


My chat is printed into a textarea named taChat



taChat.appendText(chat + '\n');


Any help is appreciated!


Remove last element after append

I have the following where #maincontent contains some images that will load into #gallery. The problem right now is that if I click on #maincontent img and load different images into #gallery for a lot of times, the loading just got draggier and draggier. Is it because when I click on the next image, it's simply on top of the previous image and the images just pile up over time? I'm not very familiar with .append() and .last() and I'm just wondering how to remove the previously loaded image after the newest image is loaded. I've tried $('img:last-child', this).remove() but it doesn't seem to work, so I just wonder if I'm on the right track.



$('#maincontent img').click(function(){
$myFile = $(this).attr('src');
$('#gallery').append('<img src="'+$myFile+'" />');
$('#gallery img').last().css('display','none').fadeIn();

Java: represent a color image as an array of gray scale intensity values

Is there a built-in utils to represent a color (or gray scale image) as an array of the gray scale intensity values?


If not, suppose I have a BufferedImage img, how can I represent this image as an array like this:



int[][] intensity = toIntensity(img);


How should the toIntensity() method look like?


Maximum Image/SpriteSheet Dimension for mobile phaser.js

I'm a newbee on this area.


I am currently developing card games. just for fun


on desktop i don't encounter problems on drawing portion of image on a sprite sheet to the canvas using Phaser-framework.


But when i move my application to open it on mobile browsers like the Phaser cannot draw portion of the sprite sheet to the canvas because of the image being used is 1012 x 3324 in dimension;


Does anyone has any idea on what it the maximum sprite sheet for mobile browsers


im not having on trouble on chrome browser.


but when used firefox and android browser give me trouble.


ctx.drawImage gives NS_ERROR_NOT_AVAILABLE


Bug 574330 - NS_ERROR_NOT_AVAILABLE with canvas.drawImage and Image.onload


hope you could help me out.


Optimising CImage Rotation

I'm attempting to optimise some CImage manipulations by using GetBits() rather than the time consuming GetPixel() SetPixel() method.


These variables are defined (with CImage *i as a parameter);



int height = i->GetWidth(); //width and height swapped for 90 degree rotation

int width = i->GetHeight();
int bpp = i->GetBPP();
int pitch1 = i->GetPitch();

int hwidth = width / 2;
int hheight = height / 2;

double sinma = sin(1.57079633f); //90 degree rotation
double cosma = cos(1.57079633f);

CImage *dest = new CImage();
dest->Create(width, height, bpp);
int pitch2 = dest->GetPitch();


The non-optimised code works fine:



for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
int yt = x - hwidth;
int xt = y - hheight;

int ys = (int)round((cosma * xt - sinma * yt) + hwidth); //get rotated pixel
int xs = (int)round((sinma * xt + cosma * yt) + hheight);

if (xs >= 0 && xs < height && ys >= 0 && ys < width) {
// set target pixel (x,y) to color at (xs,ys)
dest->SetPixel(x, y, i->GetPixel(xs, ys));
}
else {
// set target pixel (x,y) to some default background
COLORREF pixel = RGB(0, 0, 0);
dest->SetPixel(x, y, pixel);
}
}
}


This produces a perfect result


Correct rotation


but a weird result occurs when optimising:



for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{

int yt = x - hwidth;
int xt = y - hheight;

int ys = (int)round((cosma * xt - sinma * yt) + hwidth);
int xs = (int)round((sinma * xt + cosma * yt) + hheight);

if (xs >= 0 && xs < height && ys >= 0 && ys < width) {
// set target pixel (x,y) to color at (xs,ys)
//dest->SetPixel(x, y, i->GetPixel(xs, ys));

lAdrs2 = x * pitch2 + y * 3; // set target pixel (x,y)
lAdrs1 = ys * pitch1 + xs * 3; // to color at (xs,ys)

bRed = *(pInImage + lAdrs1);
bGreen = *(pInImage + lAdrs1 + 1);
bBlue = *(pInImage + lAdrs1 + 2);

*(pOutImage + lAdrs2) = static_cast<BYTE>(bRed);
*(pOutImage + lAdrs2 + 1) = static_cast<BYTE>(bGreen);
*(pOutImage + lAdrs2 + 2) = static_cast<BYTE>(bBlue);
}

}
}


Sideways image


When the angle is set to 0, this happens


flipped image?


Any reason that this occurs when accessing the bits manually?


How do I add pictures using JavaFX?

I'm trying to use ImageView to add a picture in my JavaFX application. So far I have the following implementation that is throwing a InvocationTargetException. Is there something wrong with my implementation?



public class TowerDefense extends Application {
@Override public void start(Stage stage) {
// load the image
Image image = new Image("MapCropped.png");

//displays ImageView image
ImageView one = new ImageView();
one.setImage(image);
HBox box = new HBox();
box.getChildren().add(one);
Scene scene = new Scene(box);

stage.setTitle("Balloon Tower Defense");
stage.setWidth(415);
stage.setHeight(200);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}

}

Anchor tag in div isn't working

In my CSS, the img is the same size as the a, and when you hover over the img, it changes the opacity to 0, as changing the display to none just flashes the img when moving the mouse. For some reason, the I can't click the link. How can I format the HTML/CSS to make the image disapear, and make the link clickable?



<div>
<img src="google.png">
<a href="https://www.google.com/">
Google
</a>
</div>

Saving images from a URL on the front-end with Paperclip

I'd like to first state that I'm fully aware of saving images from a URL on the backend with the help of this post. What I'd like to do in this particular case is simply copy/paste the url into my avatar input field in my new and edit views.


Everything works fine when I first save the model instance but if I were to go back to the edit view, the path to where the image was saved becomes the value of the previously mentioned input field:



/system/users/avatars/000/000/001/original/d12d224a55502a7263efca696ffccefe2c900613?1429479645


Now if I were to save with this value filled in I'll receive this error upon update:



Paperclip::AdapterRegistry::NoHandlerError in ArtistsController#update
No handler found for "/system/users/avatars/000/000/001/original/d12d224a55502a7263efca696ffccefe2c900613?1429479645"


I was wondering if there was clean way to instruct the backend to only use a newly inserted URL image path (if there is one) and not to refer to the relative path where its currently saved.



<%= simple_form_for(@user) do |f| %>
...
<div class="form-inputs">
<%= f.input :avatar, as: :string %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

java Fields not aligning right with GridBagLayout, unable to implement background image

So I've been working away, learning to write in java, and I'm getting close to a usable interface, but I'm having 2 problems. When I try to implement the CloudPanel that I overrode the paint component in, it won't let me set a gridbaglayout in that panel. To try to get everything else working while I figure out why I can't get that done, I created a new basic JPanel to fill the form with. It's almost right, but its forcing the Price JTextField off the side of the screen or just not showing it, while the label for it is in the center of it's line instead of at the left as it should be. Any clue what I'm doing wrong here?



package newprovider;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.*;

/*@Michael Christopher, author/owner */
public class NewProvider {
/** @param args the command line arguments*/

public static class CloudPanel extends JPanel {
//paint background
String backgroundPath="/images/CloudBack.png";
@Override
public void paintComponent(Graphics cloud){
super.paintComponent(cloud);
Image back = new ImageIcon(getClass().getResource(backgroundPath)).getImage();
cloud.drawImage(back, 0,0, this);
}
}
public static void createGUI() {
//build main frame
JFrame mainFrame = new JFrame();
mainFrame.setTitle("New Provider Interface");
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create the MenuBar - needs
JMenuBar maintenanceMenuBar = new JMenuBar ();
maintenanceMenuBar.setOpaque(true);
maintenanceMenuBar.setBackground(new Color(176,224,230));
maintenanceMenuBar.setPreferredSize(new Dimension(400, 20));

//create variables
int addProviderCheck;
String[] options = {"Yes","No"};
String[] newExit = {"Exit", "New"};

//create labels and JTextFields
JLabel labelID = new JLabel ("New ProviderID");
final JTextField textID = new JTextField("providerID ", 10);
JLabel labelName = new JLabel ("New Provider Name");
final JTextField textName = new JTextField("Provider Name ", 20);
JLabel labelPrice = new JLabel ("New Provider Price");
final JTextField textPrice = new JTextField ("Price ", 5);
//make Submit, Clear, & Exit buttons
JButton submit = new JButton("Submit");
JButton clear = new JButton("Clear");
JButton exit = new JButton("Exit");

//build main Panel
CloudPanel fieldBox = new CloudPanel();
JPanel buttonBar = new JPanel(new GridBagLayout());
buttonBar.setBackground(Color.red);
buttonBar.setSize(40, 300);
//GridBag constraints
GridBagConstraints bGUI = new GridBagConstraints();
//Adding buttons to Panel
bGUI.insets = new Insets(5,20,5,20);
bGUI.gridx = 0;
bGUI.gridy = 1;
buttonBar.add(submit,bGUI);
bGUI.insets = new Insets(5,20,5,20);
bGUI.gridx = 1;
bGUI.gridy = 1;
buttonBar.add(clear,bGUI);
bGUI.insets = new Insets(5,20,5,20);
bGUI.gridx = 2;
bGUI.gridy = 1;
buttonBar.add(exit,bGUI);

//Creation of Login Panel
JPanel Login = new JPanel(new GridBagLayout());
//Login.setBackground(Color.white);
//GridBag Adding Labels and Text to Login with Constraints
GridBagConstraints lGUI = new GridBagConstraints();

lGUI.insets = new Insets(20,05,20,05);
lGUI.gridx = 0;
lGUI.gridy = 1;
Login.add(labelID,lGUI);
lGUI.insets = new Insets(20,05,20,05);
lGUI.gridx = 1;
lGUI.gridy = 1;
Login.add(textID,lGUI);
lGUI.insets = new Insets(20,05,20,05);
lGUI.gridx = 0;
lGUI.gridy = 2;
Login.add(labelName,lGUI);
lGUI.gridx = 1;
lGUI.gridy = 2;
Login.add(textName,lGUI);

lGUI.gridx = 0;
lGUI.gridy = 3;
Login.add(labelPrice,lGUI);
lGUI.gridx = 1;
lGUI.gridy = 3;
Login.add(labelPrice,lGUI);
//add panels to frame
mainFrame.add(Login, BorderLayout.CENTER);
mainFrame.add(buttonBar, BorderLayout.SOUTH);

//focusListeners for ID Field
textID.addFocusListener(new FocusListener(){

@Override
public void focusGained(FocusEvent e) {
textID.setText("");
}

@Override
public void focusLost(FocusEvent e) {
if (!e.isTemporary()) {
String checkID = textID.getText();
Boolean validID = false;
if (checkID.isEmpty()){
JOptionPane.showMessageDialog(mainFrame, "Please enter a valid ID.");
SwingUtilities.invokeLater(new FocusGrabber(textID));
}
else while (validID = false){

}
}
}
});

//ActionListener for Submit button
submit.addActionListener((ActionEvent e) -> {
String Name;
Name = textName.getText();
int ID = Integer.parseInt(textID.getText());
double Price = Double.parseDouble(textPrice.getText());
int submitPress = JOptionPane.showOptionDialog(null,
"ProviderID: " + ID + "\n" + "Provider Name: " + Name +"\n"
+ "Provider Price: " + Price, "Please Verify Content",
JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,
null, options,options[0]);
if (submitPress <= 0) {
//Store Displayed data
int providerID = ID;
String providerName = Name;
Double providerPrice = Price;
System.out.println(providerID);
System.out.println(providerName);
System.out.println(providerPrice);//add method to store println()s to database
//Popup Confirm dialog to reset fields or exit
int confirmNew = JOptionPane.showOptionDialog(null, "New Provider Confirmed\n" + "Would you like to exit the module or add another provider?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, newExit, newExit[0]);
if (confirmNew <=0) {
mainFrame.setVisible(false);
mainFrame.dispose();
} else if (confirmNew > 0) {
textID.setText("providerID");
textName.setText("Provider Name");
textPrice.setText("Price");
}
}
else if (submitPress > 0) {
textID.setText("providerID");
textName.setText("Provider Name");
textPrice.setText("Price"); }
});
//ActionListener for clear button
clear.addActionListener((ActionEvent e) -> {
textID.setText("providerID");
textName.setText("Provider Name");
textPrice.setText("Price");
});
//ActionListener for Exit Button
exit.addActionListener((ActionEvent e) -> {
mainFrame.setVisible(false);
mainFrame.dispose();
});
//verify intent to add new provider to system before continuing
addProviderCheck = JOptionPane.showOptionDialog(null,
"This will add a new service provider to the database.\n"
+ "Are you sure you wish to continue?","Please Verify Intent", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, options,options[0]);
if (addProviderCheck <= 0) {
//Display Window
mainFrame.pack();
mainFrame.setSize(400, 400);
mainFrame.setVisible(true);}
else { //else close app
mainFrame.setVisible(false);
mainFrame.dispose();
}

// mainFrame.setVisible(true);
}
public static void main(String[] args){
//draw and show the GUI
javax.swing.SwingUtilities.invokeLater(() -> {
createGUI();
});
//store new provider data
}
}

How to add image as background to JButton?

I am starting with java. I try with ImageIcon but that not works


I need this http://ift.tt/1G9Ny89


but I have this http://ift.tt/1G8J0vP


Sorry I need reputation to upload images.


Android: How do i display this image into a bitmap?

What i'm doing/trying to do, is. 1. Take a photo 2. Save it 3. Load/display it into a Bitmap


Opening the Built in camera application:



public void openCamera() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory()+ File.separator + "image.jpg");
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}


onActivityResult:



protected void onActivityResult(int requestCode, int resultCode, Intent data){
//Check that request code matches ours:
if (requestCode == REQUEST_IMAGE_CAPTURE){
//Get our saved file into a bitmap object:
File file = new File(Environment.getExternalStorageDirectory()+File.separator + "image.jpg");
Bitmap image = decodeSampledBitmapFromFile(file.getAbsolutePath(), 1000, 700);
}
}


decodeSamoleBitmapFromFile:



public static Bitmap decodeSampledBitmapFromFile(String path, int reqWidth, int reqHeight)
{ // BEST QUALITY MATCH

//First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);

// Calculate inSampleSize, Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
options.inPreferredConfig = Bitmap.Config.RGB_565;
int inSampleSize = 1;

if (height > reqHeight)
{
inSampleSize = Math.round((float)height / (float)reqHeight);
}
int expectedWidth = width / inSampleSize;

if (expectedWidth > reqWidth)
{
//if(Math.round((float)width / (float)reqWidth) > inSampleSize) // If bigger SampSize..
inSampleSize = Math.round((float)width / (float)reqWidth);
}

options.inSampleSize = inSampleSize;

// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;

return BitmapFactory.decodeFile(path, options);
}


I was hoping for it to load it into a bitmap. If anyone could point me in the right direction that would be very helpful!


Problems with logo not appearing on background image

I used photoshop to layer a logo over a background image. I have the background image set up that it is responsive. I set up a image map to use the logo as a main page link. I works well on two of the other pages of the site but this page is different because of the way the background image is set up. I thought I could play a trick by using a transparent image along with usemap. did not work. I am able to see the hand when I hover over the image map, but there is no logo there. the url is http://ift.tt/1Dqozq0. an example of the logo on the upper left hand corner is http://ift.tt/1DxKZcg. I had a similar problem with the im-new-here page. The "top-bar" div (which is transparent) that is on top of the upper part of the image, was covering the clickable area. Samuel responded and I added div#top-bar { height: 0px; } and it fixed it. worked nicely, but the same fix won't work here.



<style>
body {

background: url(images/cd-background-1.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: relative;
min-height: 100%;
z-index: 1; }
</style>

<div style="text-align: center; height: 800px;">
<img src="images/trans.png" usemap="#logomap">
<map name="logomap">
<area shape="poly" coords="11,2,430,3,432,307,3,320"

style="outline:none;" href="index.html" alt="main page">
</map>


</div>

Getting text to display in front of subplot images

Ive got a lot of images of galaxies through different filters. each line of subplots represents a new object with a unique 'ID'. Im plotting all of these images using the subplot function but am having trouble adding the ID name. Ideally the ID would stretch in front of several subplots but at the moment it is placed behind (see picture). Does anyone know of a way to fix this? object filter images



plt.close('all')
ID=np.array([])
cata=csv.reader(open('final_final_list.csv',"rU"))
for x in cata:
ID=np.append(ID,x[0])
filterset=['ugr','i1','z','Y','J','H','Ks']
test2=np.array([])
for i in range(0,len(ID)):
for j in range(0,len(filterset)):
test2=np.append(test2,'filt_image/'+ID[i]+'/'+filterset[j]+'.png')
ID2=np.repeat(ID,7)
filterset2=filterset*64
array=np.arange(0,140,7)
plt.figure()
for i in range(0,140):
plt.subplot(20,7,i+1)
plots=img.imread(test2[i])
plt.imshow(plots)
plt.axis('off')
plt.text(0,100,filterset2[i],fontsize='10')

for i in array:
plt.subplot(20,7,i+1)
plt.annotate(ID2[i],xy=(0,300),xytext=(0,300),fontsize='10')
plt.show()

Pixelmator images not showing in Xcode

For about 1 week I can't edit an image in Pixelmator, export it to JPG or PNG (probably also the rest) and use it for one of my iPhone applications.



  • I still can use images which are not exported from Pixelmator

  • Both real iPhone as simulator won't display the images

  • They don't look different from other PNG or JPG's

  • I can browse in the Project Navigator and the Storyboard of Xcode and see them but can't attach the images to UIImageViews via code.

  • I deleted Pixelmator and re-downloaded it but nothing changed.


Help me please.


Remove vertical space when adding Images next to each other using HTML

I am very new to html and css coding and recently i created my own website using wordpress.


In one of the pages in wordpress i wanted to add images next to each other separated with a small space; something that i did successfully but unfortunately the images are not horizontally aligned. The second and third images are positioned further down from the first image.


The html coding that i used without making any changes to css is the following:





<a href="http://ift.tt/1IZQi8I"><img style="float: left;" src="http://ift.tt/1FYediV" alt="Northern_Ireland_MDM_Indicator" width="150" height="150" hspace="10" />
</a>
<a href="http://ift.tt/1IZQfKl"><img style="float: left;" src="http://ift.tt/1FYeeDs" alt="Northern_Ireland_School_Service_Areas" width="150" height="150" hspace="10" />
</a>
<a href="http://ift.tt/1IZQi8K"><img style="float: left;" src="http://ift.tt/1FYedzb" alt="PCs_Gross_Wage" width="150" height="150" hspace="10/" />
</a>



Any help will be much appreciated.


Many Thanks Demis


Retrieve image and display in picturebox with image path stored in database c#

I have Image Paths stored in my database under a column called Image in the format of Images\ac.jpg The path is already stored in a textbox called txtImage.Text. I am trying to display it in a picturebox control but I get the following error:



An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Drawing.dll


Additional information: Images\ac.jpg




pbCoffeeImage.Image = System.Drawing.Image.FromFile(txtImage.Text);

Having trouble with user input in moving an image vertically

So I need to move an image vertically by user input however, when I press the defined key nothing happens. I don't know if the command Im using to draw the new image going vertically is wrong or my function is. Any help would be appreciated!


Script.js



var map = document.getElementById("map");
var ctx = map.getContext("2d");

var baseImage = new Image();
baseImage.src = "assets/base.png";
baseImage.addEventListener("load", drawImage);

var speedyImage = new Image();
speedyImage.src = "assets/speedy.png";
speedyImage.addEventListener("load", drawImage);

var bubbleImage = new Image();
bubbleImage.src = "assets/bubble.png";
bubbleImage.addEventListener("load", drawImage);

document.addEventListener('keydown', function(event){ handleKeyPress(event);});

var dt = 1000/30.0;

function intersectRect(r1, r2) { // detects collision

return !(r2.left > r1.right ||
r2.right < r1.left ||
r2.top > r1.bottom ||
r2.bottom < r1.top);

}


function drawImage(){
setInterval(update, 1000/30.0);
}



var x = 0;
var y = 0;
var speed = 0.05;
var direction = 1;
document.getElementById("score").innerHTML = 0;


function update(){
ctx.clearRect(0, 0, map.width, map.height);

for(var i = 0; i < 1; i++){
ctx.drawImage(bubbleImage,x, map.height - baseImage.height - 50);
function handleKeyPress(event){
if(event.keyCode == 32){ // if space
// trouble here... would I just use the draw image function again?

}
}
}

for(var i = 0; i < 3; i++){
ctx.drawImage(speedyImage,x,0);
ctx.drawImage(speedyImage,x,70);
ctx.drawImage(speedyImage,x,150);
if(intersectRect(bubbleImage,speedyImage) == false)
score+= score+100;

}


ctx.drawImage(baseImage, x, map.height - baseImage.height );
y += speed*direction*dt;
x += speed * direction * dt;

if (x > map.width - baseImage.width || x < 0)
direction = -direction;

}

GetView method is not getting called in android list view

I am new to android.I want to work with list view that contain both image and text.getView method is not getting called while I am trying to debug.I need a solution for this.I am trying to bind the item data to list view.Here is my code



public class ResultActivity extends ActionBarActivity {
public List<String> itemList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
JSONObject obj = null;
try {
obj = new JSONObject(getIntent().getStringExtra("json"));
} catch (JSONException e) {
e.printStackTrace();
}
try {
parseJsonData(obj);
} catch (JSONException e1) {
e1.printStackTrace();
}
}
public void parseJsonData(JSONObject obj) throws JSONException {


try {

int j=0;
String ack = (String) obj.get("ack");
int itemCount =obj.getInt("itemCount");
String ItemPrice="";

for(j=0;j<itemCount;j++) {
itemList = new ArrayList<String>();
String itemObject = "item"+1;

JSONObject itemObj = obj.getJSONObject(itemObject);

JSONObject BasicInfoObj =itemObj.getJSONObject("basicInfo");
JSONObject sellerInfoObj =itemObj.getJSONObject("sellerInfo");
JSONObject shippingInfoObj = itemObj.getJSONObject("shippingInfo");
String galleryURL = BasicInfoObj.getString("galleryURL");
String pictureURLSuperSize =BasicInfoObj.getString("pictureURLSuperSize");
int CurrentPrice=BasicInfoObj.getInt("convertedCurrentPrice");
int shippingServiceCost =BasicInfoObj.getInt("shippingServiceCost");
String title =BasicInfoObj.getString("title");

if(CurrentPrice == 0)
{
ItemPrice ="Price:"+" "+"$"+shippingServiceCost+" "+"(FREE Shipping)";
}
else
{
ItemPrice = "Price:"+" "+"$"+shippingServiceCost+" "+ "(+$"+ CurrentPrice+ "for Shipping)";
}
itemList.add(0,galleryURL);
itemList.add(1,pictureURLSuperSize);
itemList.add(2,title);
itemList.add(3,ItemPrice);
populateListView();

}
}


catch (JSONException e) {
e.printStackTrace();
}
}

private void populateListView()
{
ArrayAdapter<String> adapter =new MyListAdapter();
ListView list =(ListView) findViewById(R.id.ItemListView);
list.setAdapter(adapter);
adapter.getCount();


}
private class MyListAdapter extends ArrayAdapter<String> {
public MyListAdapter()
{
super(ResultActivity.this,R.layout.item_view,itemList);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View itemView = convertView;
if(itemView==null) {
itemView =getLayoutInflater().inflate(R.layout.item_view,parent,false);
}
String itemtowork =itemList.get(position);
ImageView imageView =(ImageView)itemView.findViewById(R.id.item_icon);
//String ImageUrl=itemtowork.;
//imageView.setImageURI();

return itemView;
}


}




@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);

}


}