android show image in default gallery viewer |
Gallery application does not accept URL for an image as part of the Intent.
You need to save the image first. Then you can launch the default image
viewer with something like this:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + "/sdcard/test.jpg"),
"image/*");
startActivity(intent);
|
Open Image in default android image viewer |
Please try to use bellow code.
// open camera
try {
Intent action = new Intent(
"android.media.action.IMAGE_CAPTURE");
action.putExtra(
MediaStore.EXTRA_OUTPUT,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
.toString());
startActivityForResult(action,
TAKE_PICTURE_FROM_CAMERA);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// save image
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
bmp = (Bitmap) data.getExtras().get("data");
iv.setImageBitmap(bmp);
}
|
How to show rdlc report as pdf in mozzzilla pdf viewer? |
How to render RDLC to PDF in IE and Opera
http://www.danielroot.info/2009/06/how-to-render-reporting-services.html
|
How can I view the output of `git show` in a diff viewer like meld, kdiff3, etc |
You can use git difftool to show a single commit.
Say you want to see the commit with the sha1 abc123:
git difftool abc123~1 abc123
(~1 tells git to move to the previous commit, so abc123~1 is the commit
before abc123)
If you use this regularly, you could make a custom git command to make it
easier:
Create a file called git-showtool somewhere on your $PATH with the
following contents:
git difftool $1~1 $1
Give that file execute permissions:
chmod +x ~/path/to/git-showtool
Use the command git showtool <sha1 or tag or ...>
Profit.
|
image viewer using css is not working |
I redid this for you. Try this and you should be good. It looks like you
have your relative and absolute positioning mixed up.
HTML
<!-- Begin Image Hover -->
<ul class="enlarge">
<!-- First Image -->
<li>
<img src="image.jpg" width="150px" height="100px" alt="Dechairs"
/><span><img src="image.jpg" alt="Deckchairs" /><br
/>Deckchairs on Blackpool beach</span>
</li>
<!-- Second Image -->
<li>
<img src="image.jpg" width="150px" height="100px" alt="Blackpool
sunset" /><span><img src="image.jpg" alt="Blackpool sunset"
/><br />Sunset over the Irish Sea at Blackpool</span>
</li>
<!-- Third Image -->
<li>
<img src="i
|
Image viewer and high ram usage |
Here is my take:
<Window x:Class="LargeJpeg.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Image x:Name="Image" Stretch="None"/>
</Window>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.CacheOption = BitmapCacheOption.None;
bitmap.UriSource = new Uri(@"C:5x5.jpg", UriKind.Absolute);
bitmap.DecodePixelWidth = (int)Image.ActualWidth;
bitmap.EndInit();
bitmap.Freeze();
Image.Source = bitmap;
}
}
Average memory usage: 130 mb on a
|
How to add textview for android image “viewer” app |
try this code
package com.imageviewexample;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
public class ImageViewExample extends Activity implements OnClickListener {
/** Called when the activity is first created. */
TextView txt;
int image_index = 0;
private static final int MAX_IMAGE_COUNT = 3;
private Integer[] mImageIds = {
R.raw.image1,
R.raw.image2,
R.raw.image3
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btnPrevious = (Button)findViewById(R.id.pr
|
UIWebView image viewer in Xcode |
This is not perfect solution but its a work around:
While loading your webpage (her dropbox page), call this javascript
function "window.scrollTo(xpos, ypos);" here is tutorial for scrollto
method.
To call javascript function over webview, you require to
NSString* javascript = [NSString stringWithFormat:@"window.scrollBy(0,
yPosValueHere);"];
[webView stringByEvaluatingJavaScriptFromString:javascript];
Now where to call this method:
You can use UIWebViewDelegate methods for this like:
– webViewDidFinishLoad:(UIWebView *)webView
Hope this might help to solve your prob.
Note: User can scroll up manually and see that page.
|
How to add image from Database in Crystal Report viewer? |
Ok I was using SQLite and important thing that is to be done is to create
1.) A BLOB field to save your data is to be used.
2.) Use the following code to select the file. For this one need to call
the Open Dialog Box.
{
OpenFileDialog of1 = new OpenFileDialog();
of1.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files
(*.jpg)|*.jpg";
of1.ShowDialog();
tbImage.Text = of1.FileName;
}
Note: Don't forget to set the related Database Field type as System.byte[];
3.) Now convert the file into Byte Stream.
{
byte[] imageBt = null;
FileStream fstream = new
FileStream(tbImage.Text,FileMode.Open,FileAccess.Read);
BinaryReader br = new BinaryReader(fstream);
imageBt = br.ReadBytes((int)fstream.Length);
}
4.) Insert the image in the database
{
String query = "In
|
How to get image coordinates and color data per pixel clicking on a displayed image? |
The Data Cursor does exactly what you want:
http://www.mathworks.co.uk/help/matlab/creating_plots/data-cursor-displaying-data-values-interactively.html
It is the icon to the right of the "rotate" icon in the image toolbar.
|
How to remove overflow (scroller bars) of an overlay image viewer |
You can use jquery to do this. Where you initialize your overlay, add this:
$("body").css("overflow", "hidden");
Where you close the overlay, add this:
$("body").css("overflow", "visible");
Hope this helps.
|
How I could call the native viewer on android? Or implements Zoom and rotate the Image? |
To call the native viwer :
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(new File(path)), "image/jpg");
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities =
packageManager.queryIntentActivities(i, 0);
boolean isIntentSafe = activities.size() > 0;
// Start an activity if it's safe
if (isIntentSafe) {
startActivity(i);
}
|
Show converted mouse coordinates of an element with javascript |
Here’s how to convert mouse coordinates to cell coordinates and display a
tooltip
This math calculates which 75x75 cell your mouse is inside:
var col=parseInt(mouseX/75);
var row=parseInt(mouseY/75);
And here is the math to calculate a tip rectangle in the upper-right of
that cell:
var tipX=tipCol*75+75-tipWidth;
var tipY=tipRow*75;
You can use canvas to draw the tip inside the cell at your calculated
coordinates:
function tip(x,y){
var tipX=tipCol*75+75-tipWidth;
var tipY=tipRow*75;
ctx.beginPath();
ctx.rect(tipX,tipY,tipWidth,tipHeight);
ctx.fillStyle="ivory";
ctx.fill();
ctx.fillStyle="blue";
ctx.fillText(tipCol+","+tipRow,tipX+2,tipY+17);
}
Here is code and a Fiddle: http://jsfiddle.net/m1eri
|
Android : can we show many locations coordinates(lat n long) in a single google map? |
Yes it's called a marker.
It's pretty simple
GoogleMap map = ... // get a map.
// Add a marker at San Francisco.
Marker marker = map.addMarker(new MarkerOptions()
.position(new LatLng(37.7750, 122.4183))
.title("San Francisco")
.snippet("Population: 776733"));
Java doc here
http://developer.android.com/reference/com/google/android/gms/maps/model/Marker.html
If you haven't got as far as adding a map. You should follow this guide
https://developers.google.com/maps/documentation/android/map
|
How to capture an image in android with coordinates |
as for getting the image within the co-ordinates
Bitmap croppedBmp = Bitmap.createBitmap(originalBmp, startx, starty, endx,
endy);
this will create a cropped bitmap like your after
|
Finding Coordinates on a Bufferred Image |
If you have a 4 x 4 checkerboard that's 400 x 400, then each square is 100
x 100 pixels.
When you construct a BufferedImage like this, you save a Rectangle for each
square as you're doing the construction.
That way, when you do a mouse click later, you can use the contains method
of Rectangle to determine which square was clicked.
You shouldn't use absolute positioning. If your checker board takes up
half the JPanel, FlowLayout or BoxLayout works well.
|
image map coordinates ms paint for windows 7 |
Try using gimp
Link for GIMP
Its a free and powerful software for manipulating and creating images.
it should help you with finding coordinates .
|
how to dynamically crop an image around x-y coordinates? |
You could experiment with Jcrop on the client side:
http://railscasts.com/episodes/182-cropping-images-revised?view=asciicast
Or RMagick on the server side:
http://railscasts.com/episodes/374-image-manipulation
|
how to set coordinates, id and offset for a Kinetic Image |
Set Coordinates
kImage.setX(x) and kImage.setY(y)
or
kImage.setPosition(x, y)
Set ID
kImage.setId(id)
Set Offset
kImage.setOffsetX(x) and kImage.setOffsetY(y)
or
kImage.setOffset(x, y)
Sources
Kinetic.Shape#setX
Kinetic.Shape#setY
Kinetic.Shape#setPosition
Kinetic.Shape#setId
Kinetic.Shape#setOffsetX
Kinetic.Shape#setOffsetY
Kinetic.Shape#setOffset
|
Assign WCS coordinates to a FITS image |
I would advise you to start using astropy. For the purposes of your project
the astropy.wcs package can help you write a FITS WCS header, and the
astropy.io.fits API is basically identical to the pyfits one you are using
now. Moreover the help pages are excellent, and all I'm about to do is
translate their WCS building page to match your example.
To your question: FITS does not "tag" each pixel with a coordinate. I
suppose it is possible to create a pixel lookup table or something like
that, but the actual WCS is an algorithmic translation of X,Y pixels to
astrometric coordinates (in your case "Galactic"). A nice page is here.
The example I would point you to is here:
http://docs.astropy.org/en/latest/wcs/index.html#building-a-wcs-structure-programmatically
And here is my untested pseu
|
How to bind touch coordinates to the image |
I worked it out the answer to my question. It works the way I wanted,
without using the buttons. I attached below the code, hope it might be
useful for someone else.
To get the touched direction on the compass I calculate the offset angle
between the current compass bearing (degrees variable which updated by
setDegrees method called from another class) and the angle of the touch
location in relation to the Y axis.
public class CompassView extends ImageView {
private float degrees=0;
private String touchDirection;
public CompassView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
int height = this.getHeight();
int width = this.getWidth();
canvas.rotate(360-degrees,
|
Select points on image to retrieve coordinates |
Take out the XY coordinates using Java Function
like below
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView) findViewById(R.id.img);
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
// textView.setText("Touch coordinates : "
+String.valueOf(event.getX()) + "x" + String.valueOf(event.getY()));
Log.e("X",String.valueOf(event.getX())+"");
Log.e("y",String.valueOf(
|
Java paint image on negative coordinates |
I would verify you x/y position is being calculated correctly and add a
ImageObserver reference to your g.drawImage if you're painting to the
screen
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class NegativeImage {
public static void main(String[] args) {
new NegativeImage();
}
public NegativeImage() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
|
Load Image on specific coordinates on FORM |
The X/Y parameters of LoadPicture() refer to the width/height to extract
from an icon or cursor file. So it isn't what you want.
Instead, set the Form1's AutoRedraw to True and ScaleMode to 3 - Pixel and
use this line of code:
Form1.PaintPicture LoadPicture("C:UsersUserDesktop1xxx-LOGO-brand-.jpg"),
913, 486
|
Translating selection coordinates from a downscaled image |
May be i am missunderstanding, but i think you are calculating "proportion"
not "scale". The scale is product of the original dimentions with the new
ones. May be:
$scale_y = $original_height / $croptool_height;
$scale_x = $original_width / $croptool_width;
$scaled_x1 = $x1 * $scale_x;
$scaled_y1 = $y1 * $scale_y;
$scaled_x2 = $x2 * $scale_x;
$scaled_y2 = $y2 * $scale_y;
//Original height = 1000 and Croptool height = 100 ==> scale_y = 10;
Pixel (0, 45) on crop space == 45 * 10 == 450 on original image.
//Original height = 100 and Croptool height = 1000 ==> scale_y = 0.10;
Pixel (0, 450) on crop space == 450 * 0.10 == 45 on original image.
Hope this helps.
EDIT:
I am not familiar with the PHP API, but it looks like the source width and
source height provided are wrong, ma
|
Map resized image coordinates back to the original |
Have you tried using percentages? I'm not entirely sure if it will be
accurate enough though. Something like:
$newcoord['x'] = ($coord['x']/$originalWidth) * $newWidth;
$newcoord['y'] = ($coord['y']/$originalHeight) * $newHeight;
|
Using scatterplot.density with x-y coordinates causes error in image.default |
What I've found is that if the argument num.bins is high enough to seperate
each point into a single bin then you will recieve the error. Try
scatterplot.density(x, y, num.bins=11)
vs.
scatterplot.density(x, y, num.bins=10)
the default is 64. That means 64 bins in the x axis and y axis. You either
need to be lower you're bin number, add more points, or be content with the
error. Hope that helps.
|
Appending element to image area map using exact coordinates |
I notice that you've used the wrong type of quote characters - "url.com"
--> 'url.com'
The first " effectively terminates the statement that you use to set the
onclick.
Next, I've done no error checking. I've only looked for the first
<area> tag, I haven't checked that it's actually a rect, as opposed
to a poly, which may have fewer or more co-ord pairs.
Html
<img src="http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=6"
alt="HTML Map" border="0" usemap="spotLightmap-50"/>
<map name="spotLightmap-50">
<area alt="Laptops" href="url.com" coords="50,100,357,226"
shape="rect" onclick="s_objectID='url.com';return
this.s_oc?this.s_oc(e):true">
</map>
Javascript
window.addEventListener('load', mInit, false);
function newEl(tag){return docu
|
JavaScript coordinates showing as greater than the image width and height |
pageX and pageY are the coordinates relative to the top left corner of the
document not your image itself (the name already says it).
you need to subtract the offsets from your element:
$('.featuredImg').mousemove(function(e) {
var x = e.pageX - $(this).offset().left,
y = e.pageY - $(this).offset().top;
console.log(x + ' | ' + y);
});
|
Transform DICOM Image to a list of XYZ coordinates and their values - Python |
I am not very familiar with DICOM, but looking at the pydicom docs I think
the following should work:
import dicom
import numpy as np
ds = dicom.read_file('your_file.dcm')
planes, rows, cols = ds.NumberofFrames, ds.Columns, ds.Rows
image = ds.pixel_array # should have shape (planes, rows, cols)
# to get data and coords to write to CSV
image_data = image.ravel()
z, y, x = np.meshgrid(np.arange(planes), np.arange(rows), np.arange(cols),
indexing='ij').T
# to write CSV read image back into DICOM file
planes, rows, cols = np.ptp(z)+1, np.ptp(y)+1, np.ptp(x)+1
image = np.zeros((planes, rows, cols), dtype=image_data.dtype)
image[z, y, x] = image_data
ds.NumberofFrames, ds.Columns, ds.Rows = planes, rows, cols
ds.PixelData = image.tostring()
ds.save_as('another_file.dcm
|
How to get the image coordinates(points) from a picturebox irrespective of panning and zooming |
If i got you right this will draw an ellipse with center as the point where
mousedown caught,while you drag the mouse in mouse move event to expand or
not the ellipse it will be centered at the point caught by mousedown
location.About the radious it will be in the picturebox,in the code(inside
mousemove event)i placed the 2 variables Xdiff and Ydiff to get the job
done and also it shows their values in the form caption(always updating as
you move),and their values are the radious of x and y because note you
might draw an oval ellipse:
bool ismouseDown = false;
Point p;
int Xdiff, Ydiff;
Bitmap bmp;
public Form1()
{
InitializeComponent();
bmp = (Bitmap)Image.FromFile(@"C:..YourImage.jpg");
pictureBox1.Image = bmp;
}
private void pic
|
php image uplaod show default image when image has not been uploaded |
you could use file_exists(), like
if( !empty($row['article_image']) AND file_exists(YOUR_PATH .
$row['article_image']) ) {
//show your image from db
}
else {
//show your default image
}
|
Add marker to image - trouble converting back from relative to absolute coordinates |
You can create a wrapper that will have postion: relative and you image
will have position: absolute (the same as markers) then you can use offset
to get relative value and use to place a marker.
html:
<div id="wrapper">
<img src="some_image.png"/>
</div>
css:
#wrapper { position: relative; }
#wrapper img, #wrapper .marker { position: absolute; }
#wrapper .marker { z-index: 100; }
#wrapper img { top: 0; left: 0; }
javascript:
var $wrapper = $('#wrapper');
$('#wrapper img').click(function(e) {
var $this = $(this);
var offset = $this.offset();
$('<span>1</span>').addClass('marker').css({
left: e.pageX-offset.left,
top: e.pageY-offset.top
}).appendTo($wrapper);
});
|
Coordinates-based text display upon an image with Django's template system |
I ended up using the PIL library. It was finally quite easy and could be
summarized by the following code :
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
im = Image.open('path/to/map.png')
font = ImageFont.truetype('/usr/share/fonts/dejavu/DejaVuSans.ttf', 7)
draw = ImageDraw.Draw(im)
draw.text((x, y), sentence, font=font, fill='black')
response = HttpResponse(mimetype='image/png')
im.save(response, 'PNG')
return response
Logic behind x and y is irrelevant here, but bear in mind that they start
quite illogically on the upper left corner of the image and go from there
to right and bottom with positive numbers.
|
Android, show activity, download image and show on imageview (in that order) |
You need to implement an AsyncTask. Which executes on a background thread
and prevents blocking of the main thread. You simply create a class that
extends AsyncTask like below
EDIT - Yes, this will display your Activity even before the images get
downloaded. You simply call the execute() method of your AsyncTask in
onCreate() Have a look at the page on AsyncTasks above for a complete
overview. It's really simple to implement you just need to be aware of
configuration changes if your AsyncTask has not completed.
You might also want to look into caching your bitmaps in memory to prevent
them from being unnecessarily downloaded again.
public class DownloadItemDetails extends AsyncTask<String, Void,
ArrayList<Bitmap>{
protected ArrayList<Bitmap> doInBackground(String...par
|
How to retrieve the highest peak length of y-coordinates and their respective x-coordinates to a separate file using awk? |
File a.awk:
{
if ( ( NR - 1 ) in x && ( NR - 2 ) in x )
{
if ( y[NR - 1] > y[NR - 2] && y[NR - 1] > $2 )
{
printf "%d %d
", x[NR -1], y[NR - 1]
}
}
x[NR] = $1
y[NR] = $2
}
Run:
awk -f a.awk input_file
|
Delete a image, and delete from Image viewer under Win 8 |
The solution is:Impossible in this format, but this solved this problem:
RandomAccessStreamReference rs=
RandomAccessStreamReference.CreateFromUri(new Uri(path));
BitmapImage bi = new BitmapImage();
var rstream = await rs.OpenReadAsync();
bitmapImage.SetSource(rstream);
pic.Source = bi;
Image must be load to stream, and after the file can be delete.
|
ArrayList select coordinates, if there are less clients than coordinates, give each client a coordinate |
You need to override equals() in your Coordinate class.
@override
public void equals(Object o){
if(o==null)
return false;
if(!(o instanceof Coordinate)){
return false;
Coordinate newO = (Coordinate) o;
if(this.x == newO.x && this.y == newO.y)
return true
return false;
}
This is because ArrayList#contains uses ArrayList#indexOf() which is
defined as:
public int indexOf(Object o) {
if (o == null) {
for (int i = 0; i < size; i++)
if (elementData[i]==null)
return i;
} else {
for (int i = 0; i < size; i++)
if (o.equals(elementData[i])) /// <--- Uses .equals()
return i;
}
return -1;
}
Note: While you are at it also override
|
clipping rectangles, zindexing and setting coordinates of images overlapping another image using these features |
Maybe, the problem is in your selectors.
figure point0
must be replaced with
figure#point0
because "point0" is a id of a figure.
|
Using world Coordinates instead of latitude and longitude coordinates in google maps |
I found this:
var projection = new MercatorProjection();
var worldCoordinate = projection.fromLatLngToPoint(chicago);
Maybe there is a reverse way. Source:
https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
|