Windows 8 24x24 badge logo image failing wac tool test - windows-8

I am developing windows 8 app using tool Microsoft Visual Studio Express for Windows 8
When I am creating app packages to upload on app store it fails the WAC tool test and gives out following error.
Image reference "images\badge_24.png": The image "C:\Program Files\WindowsApps
\myproject\images\badge_24.png" has an ABGR value "0x1D5E50E9" at position (9, 0)
that is not valid. The pixel must be white (##FFFFFF) or transparent (00######).
I searched on net and found the link Badge Issue in VS update 1
I am not using 34x34 image for badge logo. I am using 24x24 image still I am getting the error by wac tool due which I can not submit this to App Store.
I tried with using 34x34 image but its not working can any one help me with this?

I know this problem very well. It is not related to the image size but to the image content. The error message is actually very precise - not all pixels in your badge logo fulfill the requirement that they are fully white ##FFFFFF or transparent 00######.
I suggest your first step is a confirmation that my answer is right. For that purpose just create a temporary 24x24 image which would be completely white. If you use this temp white logo the WAC should pass.
Next step would be to get a proper logo image. I did the following with GIMP graphic tool (http://www.gimp.org/downloads/):
Identify background color of your logo, navigate to Colors > Color to alpha and select the identified color. That makes your background transparent.
Now it's time to desaturate the whole picture by Colors > Desaturate
Restrict bits to ##FFFFFF and 00###### only: Navigate to Colors > Brightness-Contrast and set both Brightness and Contrast to the max values.
To be sure, I am right you might want to attach your current badge logo to your original question.

The solution is really simple! Just import your badge logo into Adode Photoshop and Press [Control + L] or Go to the menu [Image> Adjustments> Levels] and set the values as:
Channel: RGB
Input Levels up fields: 253; 1,00; 255
Input Levels down fields: 255; 255
Save your image!
Afterward, just redo do process of creating App Packages on visual Studio. Now Enjoy you app approved!

One way to automate the process is to write a litte C# console application that "fixes" the images:
Add a nuget reference to package Magick.NET.Core-Q8
Perform the following code to remove < 255 color channels:
foreach( string ThisFile in Directory.GetFiles( #"C:\YourUwpApplication\Assets", "LockScreenLogo.*.png" ) )
{
using( ImageMagick.MagickImage TheImage = new ImageMagick.MagickImage( ThisFile ) )
{
ImageMagick.PixelCollection Pixels = TheImage.GetPixels();
for( int IX = 0; IX < TheImage.Width; IX++ )
{
for( int IY = 0; IY < TheImage.Height; IY++ )
{
Pixels[ IX, IY ].SetChannel( 0, 255 );
Pixels[ IX, IY ].SetChannel( 1, 255 );
Pixels[ IX, IY ].SetChannel( 2, 255 );
}
}
TheImage.Write( ThisFile );
}
}
Enjoy
-Simon

Possible option (worked for me) remove:
<uap:LockScreen Notification="badgeAndTileText" BadgeLogo="" />
from Package.appxmanifest file (as xml)
If the app has nothing to do with LockScreen notifications, this seems to be an option.

Related

How can I convert "rs2::video frame" to "CvCapture* "?

I'm newbie to the Intel Realsense SDK and coding in Visual Studio 2017(C or C++) for Intel Realsense camera D435.
In my example I have the following,
static rs2::frameset current_frameset;
auto color = current_frameset.get_color_frame();
frame = cvQueryFrame(color);
I've got an error on line 3 as "can not convert 'rs2::video_frame' to 'CvCapture'"
I've not being able to find a solution to this issue and it's proving difficult and resulted in more errors.
Does anyone know how I can overcome this problem?
Thanks for the help!
The cvQueryFrame accepts cvCapture instance, and it is used to retrieve the frame from camera. In LibRS, the frame you retrieved back can be used already, you don't have to get back it again. attached the snippet of CV example in LibRS, you can refer to the complete code here
rs2::pipeline pipe;
// Start streaming with default recommended configuration
pipe.start();
using namespace cv;
const auto window_name = "Display Image";
namedWindow(window_name, WINDOW_AUTOSIZE);
while (waitKey(1) < 0 && cvGetWindowHandle(window_name))
{
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera
rs2::frame depth = color_map(data.get_depth_frame());
// Query frame size (width and height)
const int w = depth.as<rs2::video_frame>().get_width();
const int h = depth.as<rs2::video_frame>().get_height();
// Create OpenCV matrix of size (w,h) from the colorized depth data
Mat image(Size(w, h), CV_8UC3, (void*)depth.get_data(), Mat::AUTO_STEP);
// Update the window with new data
imshow(window_name, image);
}

Mac OSX: How to detect that NO window is selected?

I am working on the app which resizes the selected window.
It works successfully when any window is selected. But crashes when no window is selected.
Currently fetching front most window from the following code.
AXUIElementCopyAttributeValue(frontMostApp, kAXFocusedWindowAttribute, (CFTypeRef *)&frontMostWindow);
But how to detect that control is on desktop or all the windows are inactive.
AXUIElementCopyAttributeValue() returns AXError, so you can catch it and then check what happened.
AXError error = AXUIElementCopyAttributeValue(frontMostApp, kAXFocusedWindowAttribute, (CFTypeRef *)&frontMostWindow);
if (error != kAXErrorSuccess) {
//solve problems here
}
In your specific case there is a value of an error returned: kAXErrorNoValue = -25212
You can use AppleScript to do this. When creating a new project in Xcode, you can choose "Cocoa-AppleScript" as your app type by going under OS X > Other to make an app that has both Obj-C and AppleScript. You can use this code to make the app that has focus do something:
tell current app to ...
You can use this code to change the size of the window
set the bounds of the front window to {x, y, x + width, y + height}
Here, x and y are the distance from the top-left corner.
You can add this to your project and modify the size of the window that is currently at the front. This means that the frontmost window of the app with focus will be resized. This is a working and fully interactive example:
set theWindows to the windows of the current application
if the length of theWindows is 0 then
display alert "There are no windows to resize"
else
display dialog "Enter x" default answer ""
set x to text returned of result as number
display dialog "Enter y" default answer ""
set y to text returned of result as number
display dialog "Enter width" default answer ""
set width to text returned of result as number
set width to (x + width)
display dialog "Enter height" default answer ""
set height to text returned of result as number
set height to (y + height)
tell current application to set the bounds of the front window to {x, y, width, height}
end if
In Yosemite you can create apps that have nothing at their core but AppleScript with the "Script Editor" application. In Mavericks and older systems the app is called "AppleScript Editor". If you need Objective-C for other parts of your app you can create a Cocoa-AppleScript program using the method I described earlier.

Change the tile image of a shortcut tile pinned on the metro desktop

we have created a tile shortcut, which is similar to pinning the IE shortcuts on the screen. We have done this through code. We want an image should come on this tile. How do we add image to such a shortcut tile. we are running an exe first on windows 7 desktop mode and then making the pin to screen event click using the shell scripting. the tile is similar to any internet address pinned on the desktop
See this sample app...
The basic code you will need to achieve this is as follows...
Uri logo = new Uri("ms-appx:///Assets/squareTile-sdk.png");
Uri smallLogo = new Uri("ms-appx:///Assets/smallTile-sdk.png");
string tileActivationArguments = MainPage.logoSecondaryTileId + " WasPinnedAt=" + DateTime.Now.ToLocalTime().ToString();
SecondaryTile secondaryTile = new SecondaryTile(MainPage.logoSecondaryTileId,
"Title text shown on the tile",
"Name of the tile the user sees when searching for the tile",
tileActivationArguments,
TileOptions.ShowNameOnLogo,
logo);
secondaryTile.ForegroundText = ForegroundText.Dark;
secondaryTile.SmallLogo = smallLogo;
bool isPinned = await await secondaryTile.RequestCreateAsync();

iTextSharp Overlay Image

Hi guys I have an instance where I have a logo image as part of some artwork..
If a user uploads a new logo I have a form field which is larger than the default logo.
I then use that form field to position the new image.
The problem is I need to set the background colour of that form field to white so that it covers the old logo in the event that the new image is smaller than the old logo..
what I have done is:
foreach (var imageField in imageReplacements)
{
fields.SetFieldProperty(imageField.Key, "bgcolor", iTextSharp.text.Color.WHITE, null);
fields.RegenerateField(imageField.Key);
PdfContentByte overContent = stamper.GetOverContent(imageField.Value.PageNumber);
float[] logoArea = fields.GetFieldPositions(imageField.Key);
if (logoArea != null)
{
iTextSharp.text.Rectangle logoRect = new iTextSharp.text.Rectangle(logoArea[1], logoArea[2], logoArea[3], logoArea[4]);
var logo = iTextSharp.text.Image.GetInstance(imageField.Value.Location);
if (logo.Width >= logoRect.Width || logo.Height >= logoRect.Height)
{
logo.ScaleToFit(logoRect.Width, logoRect.Height);
}
logo.Alignment = iTextSharp.text.Image.ALIGN_LEFT;
logo.SetAbsolutePosition(logoRect.Left, logoArea[2] + (logoRect.Height - logo.ScaledHeight) / 2);
// left: logoArea[3] - logo.ScaledWidth + (logoRect.Width - logo.ScaledWidth) / 2
overContent.AddImage(logo);
}
}
The problem with this is that the background colour of the field is set to white and the image then doesn't appear.. i remove the SetFieldProperty and RegenerateField commands and the image replacement works fine..
is there a way to set a stacking order on layers?
Annotations (such as form fields) are always on top of page contents. Annotation Z order is just the order of the annotations array on a given page.
Page content Z order is just the order everything appears in the content stream. New drawing operators go on top of proceeding operators.
If you want to cover your old image, draw a white box over it and then draw the new logo over top that. No need to worry about annotations.
Actually, all you really need to do is not set the background color of the imageField. You're already scaling the new logo to match the size of the old one.
However, if you really must draw that white box, it's fairly simple:
overContent.setColorFill(iTextSharp.text.Color.WHITE);
overContent.rectangle( logoRect );
overcontent.fill();

Ready An Existing PDF Page Size (ex. 8.5 x 11, 11 x 17) VB.Net

Like the title says i'd like to read an existing pdf page size with VB.Net. I've been working with Itext.Sharp, and the Acrobat.dll. Is this possible??
There are a number of different "Boxes" a given page can have:
Media Box (required): The initial page size when printing viewing.
Crop Box (optional): Supersedes the media box. Defaults to match the media box. Must be a subset or match the media box.
There's also art/trim/bleed boxes, but they don't matter as much and are much less common.
So, the page size:
PdfReader reader = new PdfReader(myPath);
// gets the MEDIA BOX
Rectangle pageRect = reader.getPageSize(1); // 1 -> first page
// gets the crop box if present, or the media box if not.
Rectangle cropRect = reader.getCropBox(1);
// and finally
Rectangle artBox = reader.getBoxSize( 1, "art");
// could be "art", "bleed", "crop", "media", or "trim"
I'd go with getCropBox().
I also recommend checking out the JavaDoc for things like this. At the very least you would have come up with getPageSize() on your own. No, it's not C#. Yes, it's very useful.
http://api.itextpdf.com/
Also note that these Rectangles need not be based on 0,0 (which would be the lower left corner on an unrotated page).
Further, you should check the page's rotation, getPageRotation(int), and swap height and width if the rotation is 90 or 270. There is getPageSizeWithRotation(int), but it only works with the media box, so I'd do it yourself if I were you. It's only a few extra lines of code:
// rotation has to be 0, 90, 180, or 270. "360" isn't kosher IIRC.
if (reader.getPageRotation(pageNum) % 180 != 0) {
float tmp = width;
width = height;
height = tmp;
}