If you’re looking to pair pixel-perfect video execution with a solid Facebook marketing strategy, check out some of these. Recommended reading for Facebook video strategy. These need to be pixel perfect so that when it goes into HTML cut up the correct dimensions are preserved. What it does is keep a variable holding the smallest result of (width*height)-pixels, which is the difference between the found values and the number of pixels.Īlthough it works fine for small amounts of pixels, with huge values (which would likely return 1000x1000 sizes), it's ultra slow. Minimum dimensions: 600 x 315 (1.9:1 landscape) or 600 x 600 (1:1 square). In webdesign we often use rectangular or square shapes to represent backgrounds for sidebars etc. GetRectangle(101) // must return, 3] (width, height and additional pixels) Here's what my code looks like currently: function loopPixels(pixels, callback) Multiplying width by height must result in a value greater than orīy applying these rules I end up with a variety of possibilities, the best one being the one that, when multiplied, most closely approximates the number of pixels.(This will ensure that only the most rectangular values are kept). Dividing width by height must result in a value greater than 0.5 and.So far I have been able to solve this problem with the following rules: 100x1 also fits all pixels, but it sure is much less rectangular than 10x10.Īnd in order to fit 101 pixels the best size is 8x13, although 8*13 is 104, it's the only multiplication that doesn't lose any pixels, adds few extra pixels (3), and has the most rectangular shape. Using an image of 100 pixels as an example, the best size to fit all pixels would be 10x10, because 10*10 is 100, that is, it adds the least amount of extra pixels (in this case 0). What's the best way to calculate the size needed to fit an array of pixels into an image as close as possible to a rectangle/square shape without losing or adding unnecessary pixels?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |