Questions tagged [dimensions]

Dimensions of an array define its size and shape -- the arangement of elements in the array. Use this Tag for questions regarding the shape of arrays.

1238 questions
1960
votes
46 answers

How to get screen dimensions as pixels in Android

I created some custom elements, and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge). Therefore I need to get the screen width and screen height and then set position: int…
Niko Gamulin
  • 66,025
  • 95
  • 221
  • 286
432
votes
10 answers

Numpy array dimensions

How do I get the dimensions of an array? For instance, this is 2x2: a = np.array([[1, 2], [3, 4]])
morgan freeman
  • 6,041
  • 3
  • 25
  • 32
170
votes
6 answers

Total width of element (including padding and border) in jQuery

As in the subject, how can one get the total width of an element, including its border and padding, using jQuery? I've got the jQuery dimensions plugin, and running .width() on my 760px-wide, 10px padding DIV returns 760. Perhaps I'm doing…
tags2k
  • 82,117
  • 31
  • 79
  • 106
125
votes
6 answers

Get image width and height from the Base64 code in JavaScript

I have a Base64 image encoded that you can find here. How can I get the height and the width of it?
bombastic
  • 2,961
  • 8
  • 20
  • 18
118
votes
4 answers

How to set text size using dimension from xml at runtime programmatically?

In dimens.xml, I have: 18sp In runtime, I get this value and set the text size of a text view: int size = context.getResources().getDimensionPixelSize(R.dimen.text_medium); textView.setTextSize(size). On a 10″…
Yura Shinkarev
  • 5,134
  • 7
  • 34
  • 57
109
votes
1 answer

What is the difference between getWidth/Height() and getMeasuredWidth/Height() in Android SDK?

The Android Documentation says that there is two sizes for a view, the measured dimensions and the drawing dimensions. The measured dimension is the one computed in the measure pass (the onMeasure method), while the drawing dimensions are the actual…
lgfischer
  • 1,718
  • 3
  • 13
  • 22
106
votes
7 answers

Get file size, image width and height before upload

How can I get the file size, image height and width before upload to my website, with jQuery or JavaScript?
Afshin
  • 4,197
  • 3
  • 25
  • 34
101
votes
1 answer

Is dp the same as dip?

Possible Duplicate: Difference of px, dp, dip and sp in android I've found several topics on this. But none really answers my question. Dp and dip in android. What is the difference? Is it the same thing?
johan
  • 6,578
  • 6
  • 46
  • 68
76
votes
4 answers

How to get the the dimensions of an image file?

I have a file called FPN = "c:\ggs\ggs Access\images\members\1.jpg " I'm trying to get the dimension of image 1.jpg, and I'd like to check whether image dimension is valid or not before loading.
user682417
  • 1,478
  • 4
  • 25
  • 46
70
votes
5 answers

CUDA determining threads per block, blocks per grid

I'm new to the CUDA paradigm. My question is in determining the number of threads per block, and blocks per grid. Does a bit of art and trial play into this? What I've found is that many examples have seemingly arbitrary number chosen for these…
dnbwise
  • 1,092
  • 1
  • 9
  • 20
68
votes
4 answers

Java/ImageIO getting image dimensions without reading the entire file?

Is there a way to get the dimensions of an image without reading the entire file? URL url=new URL(); BufferedImage img=ImageIO.read(url); System.out.println(img.getWidth()+" "+img.getHeight()); img=null;
Pierre
  • 34,472
  • 31
  • 113
  • 192
65
votes
5 answers

Swapping the dimensions of a numpy array

I would like to do the following: for i in dimension1: for j in dimension2: for k in dimension3: for l in dimension4: B[k,l,i,j] = A[i,j,k,l] without the use of loops. In the end both A and B contain the same information but…
sponce
  • 1,279
  • 2
  • 11
  • 17
54
votes
6 answers

Difference between $(window).width() vs $(document).width()

What is the major difference between $(window).width() vs $(document).width() in jQuery? Whether window denotes the browser and document represents the body of html page? Am I correct ?
kbvishnu
  • 14,760
  • 19
  • 71
  • 101
54
votes
3 answers

Get image dimensions

I have an url to the image, like $var = http://example.com/image.png How do I get its dimensions to an array, like array([h]=> 200, [w]=>100) (height=200, width=100)?
James
  • 42,081
  • 53
  • 136
  • 161
49
votes
5 answers

How to get the Dimensions of a Drawable in an ImageView?

What is the best way to retrieve the dimensions of the Drawable in an ImageView? My ImageView has an Init-Method where I create the ImageView: private void init() { coverImg = new ImageView(context); …
Philipp Redeker
  • 3,848
  • 4
  • 26
  • 34
1
2 3
82 83